var site = JSON.parse(window.localStorage.getItem("station"));
// 公共组件
// 分页组件
Vue.component('v-pagination' , {
    data     : function(){
        return {
            count   : 0 ,
            current : this.currentPage ,
            isShow  : this.total
        };
    } ,
    props    : {
        total       : {     // 数据总条数
            type    : Number ,
            default : 0
        } ,
        display     : {     // 每页显示条数
            type    : Number ,
            default : 15
        } ,
        currentPage : {     // 当前页码
            type    : Number ,
            default : 1
        } ,
        pagegroup   : {     // 分页条数
            type    : Number ,
            default : 5 ,
            coerce  : function( v ){
                v = v > 0 ? v : 5;
                return v % 2 === 1 ? v : v + 1;
            }
        }
    } ,
    mounted(){
        this.current = this.currentPage;
        //this.$options.methods.pagehide(this);
    } ,
    watch    : {
        currentPage : function(){
            this.current = this.currentPage;
        }
    } ,
    computed : {
        page      : function(){ // 总页数
            return Math.ceil(this.total / this.display);
        } ,
        grouplist : function(){ // 获取分页页码
            var len = this.page , temp = [] , list = [] , count = Math.floor(this.pagegroup / 2) ,
                center                                          = this.current;
            if( len <= this.pagegroup ){
                while( len-- ){
                    temp.push({ text : this.page - len , val : this.page - len });
                }
                ;
                return temp;
            }
            while( len-- ){
                temp.push(this.page - len);
            }
            ;
            var idx = temp.indexOf(center);
            (idx < count) && (center = center + count - idx);
            (this.current > this.page - count) && (center = this.page - count);
            temp = temp.splice(center - count - 1 , this.pagegroup);
            do{
                var t = temp.shift();
                list.push({
                    text : t ,
                    val  : t
                });
            }while( temp.length );
            if( this.page > this.pagegroup ){
                (this.current > count + 1) && list.unshift({ text : '...' , val : list[ 0 ].val - 1 });
                (this.current < this.page - count) && list.push({
                    text : '...' ,
                    val  : list[ list.length - 1 ].val + 1
                });
            }
            return list;
        }
    } ,
    methods  : {
        setCurrent : function( idx ){
            if( this.current != idx && idx > 0 && idx < this.page + 1 ){
                this.current = idx;
                this.$emit('pagechange' , this.current);
            }
        }
    } ,
    template : `<nav v-if="isShow" style="background: transparent;">
                    <div class="pagination">
                        <div class="pagination-inner">
                            <span class="pagination-prep" style="width: 3.88rem" :class="{'disabled': current == 1}" @click="setCurrent(current - 1)"> 上一页 </span>
                            <span class="pagination-prep" style="width: 3.88rem" :class="{'disabled': current == 1}" @click="setCurrent(1)"> 首页 </span>
                            <span class="pagination-num" v-for="p in grouplist" :class="{'active': current == p.val}" @click="setCurrent(p.val)">{{ p.text }}</span>
                            <span class="pagination-next" style="width: 3.88rem" :class="{'disabled': current == page}" @click="setCurrent(page)"> 尾页 </span>
                            <span class="pagination-next" style="width: 3.88rem" :class="{'disabled': current == page}" @click="setCurrent(current + 1)"> 下一页 </span>
                        </div>
                    </div>
                </nav>`
});
// 模态框
Vue.component('modal-component' , {
    data     : function(){
        return {
            count : 0 ,
            root  : tmpsUrls + "www/static/icons/关闭.png"
        };
    } ,
    mounted(){
    } ,
    methods  : {} ,
    template : `<div class="modal fade" id="myModal2" tabindex="-1" role="dialog"  aria-hidden="true">
    <div class="modal-dialog modal-dialog-centered" role="document">
        <div class="modal-content">
            <div class="modal-body">
                <div class="station-title">
                    四川省——成都市
                </div>
                <div class="station-name-box">
                    <span class="station-name">锦江区</span>
                    <span class="station-name">锦江区</span>
                    <span class="station-name">锦江区</span>
                    <span class="station-name">锦江区</span>
                    <span class="station-name">锦江区</span>
                    <span class="station-name">锦江区</span>
                    <span class="station-name">锦江区</span>
                    <span class="station-name">锦江区</span>
                    <span class="station-name">锦江区</span>
                    <span class="station-name">锦江区</span>
                </div>
                <div class="station-btn" data-dismiss="modal">选择当前行政区域</div>
                <div class="close-static-modal"><img data-dismiss="modal" :src="root" alt=""></div>
            </div>

        </div>
    </div>
</div>`
});
// header组件
Vue.component('header-component' , {
    data     : function(){
        return {
            info           : "" ,
            tempUrl        : tmpsUrls ,
            loginicon      : tmpsUrls + 'www/static/icons/头像1默认.png' ,
            registericon   : tmpsUrls + 'www/static/icons/注册1.png' ,
            collecticon    : tmpsUrls + 'www/static/icons/收藏(1).png' ,
            historyicon    : tmpsUrls + 'www/static/icons/时间1.png' ,
            user_id        : getCookie("user_id") ,
            token          : getCookie("token") ,
            is_hover1      : false ,
            is_hover2      : false ,
            site           : '' ,
            site_level_txt : '' ,
            siteurl        : '',
            siteMobile:"",
			siteInfo:{}
        };
    } ,
    props    : {
        url    : {
            type    : String ,
            default : "../../"
        } ,
    } ,
    mounted(){
        this.site = JSON.parse(localStorage.getItem('station')) || {};
        if( this.site.site_level ){
            this.site.site_level == 5 ? this.site_level_txt = '基层站点' : this.site_level_txt = '行政分站';
        }

        if( this.token !== null ){
            var formdata = new FormData();
            formdata.append("user_id" , this.user_id);
            formdata.append("token" , this.token);
            axios.post(sysurl + 'user/info' , formdata).then(res => {
                if( res.data.code === 1 ){
                    this.info = res.data.data;
                    if( res.data.data.avatar != '' ){
                        this.loginicon = res.data.data.avatar_text;
                    }
                }else{
                    // layer.msg(res.data.msg);
                }
            } , err => {}).catch(( error ) => {});
        }
        this.siteurl = location.origin;



        var f = new FormData()
        f.append('site_id',this.site.site_id||0)
        axios.post(sysurl + 'user/siteInfo' , f).then(res => {
            this.siteMobile = res.data.data.site_mobile;
			this.siteInfo = res.data.data
			localStorage.setItem("siteInfo",JSON.stringify(res.data.data))
        } , err => {}).catch(( error ) => {});
    } ,
    methods  : {
        loginOut : function(){
            var formdata = new FormData();
            formdata.append("user_id" , this.user_id);
            formdata.append("token" , this.token);
            layer.confirm("确定退出登录？" , { btn : [ "确定" , "取消" ] } , function(){
                axios.post(sysurl + 'user/logout' , formdata).then(res => {
                    if( res.data.code === 1 ){
                        delCookie("token");
                        delCookie("user_id");
                        window.location.href = tmpsUrls + "www/views/login/login.html";
                    }else{
                        // layer.msg(res.data.msg);
                    }
                } , err => {
                }).catch(( error ) => {
                });
            } , function( index ){
                layer.close(index);
            });
        } ,
        mouseenEvent( type , num ){
            if(num == 1){
                this.is_hover1 = type;
            }else if(num == 2){
                this.is_hover2 = type;
            }
        }
    } ,
    template : `<header>
                    <div class="header-top" :data-name="info.nickname">
                        <div class="top_inner">
                            <div class="inner_le">您好，欢迎访问 <a href="">{{ site.site_id ?siteInfo.sitename : siteInfo.sitename }}</a></div>
                            <div class="inner_ri" v-if="info">
                                <a :href="tempUrl+'www/views/user/personal.html'" class="item">
                                    <img :src="loginicon" style="width: 1.2rem;height:1.2rem;border-radius: 50%" alt="">{{info.nickname}}
                                </a>
                                <div class="item" @mouseenter="mouseenEvent(true,1)" @mouseleave="mouseenEvent(false,1)">
                                    <a :data-href="tempUrl+'www/views/user/personal.html'"><img :src="collecticon">我的收藏</a>
                                    <collectlist-component v-if="token" v-show="is_hover1" :siteid="site" type="collect" :url="url"></collectlist-component>
                                </div>
                                <div class="item" @mouseenter="mouseenEvent(true,2)" @mouseleave="mouseenEvent(false,2)">
                                    <a :data-href="tempUrl+'www/views/user/personal.html'"><img :src="historyicon">访问记录</a>
                                    <collectlist-component v-if="token" v-show="is_hover2" :siteid="site" type="history" :url="url"></collectlist-component>
                                </div>
                                <a @click="loginOut" class="item"><img :src="historyicon">退出登录</a>
                                <!--<a href=""><img src="" alt="">团子小姐姐</a>-->
                            </div>
                            <div class="inner_ri" v-else>
                                <div class="item">
                                    <a :href="url+'views/login/login.html'" style="display:flex;align-items: center"><img :src="loginicon" style="width: 1.2rem" alt="">登录/注册/我的</a>
<!--                                    <a :href="url+'views/login/register.html'" style="display:flex;align-items: center"><img :src="registericon" alt="">注册</a>-->
                                </div>
                                <span>本站服务：{{siteMobile}}</span>
                                <!--<a href=""><img src="" alt="">团子小姐姐</a>-->
                            </div>
                        </div>
                    </div>
                </header>`
});

// header 收藏站点 - 浏览历史 组件
Vue.component('collectlist-component' , {
    data     : function(){
        return {
            token       : getCookie("token") ,       // 用户token
            user_id     : getCookie("user_id") ,   // 用户id

            collectList : [] ,     // 收藏列表
            historyList : [] ,     // 浏览历史

            limit       : 10 ,
            page        : 1 ,
            is_hover    : false
        };
    } ,
    props    : {
        siteid : {
            type : Object ,
            default(){
                return {};
            }
        } ,
        type: {
            type    : String ,
            default : 'collect'
        },
        url : {
            type    : String ,
            default : "../../"
        }
    } ,
    mounted(){
        if( this.token ){
            if(this.type == 'collect'){
                this.getCollectList();
            }else{
                this.getHistoryList();
            }
        }
    } ,
    methods  : {
        // 获取收藏站点列表
        getCollectList(){
            var data = transFormData({
                user_id : this.user_id ,
                token   : this.token ,
                limit   : this.limit ,
                page    : this.page
            });
            axios.post(sysurl + 'user/collectSiteList' , data).then(res => {
                var datas = res.data;
                if( datas.code == 1 ){
                    this.collectList = datas.data.data;
                    // console.log(datas.data.data)
                }else{
                    // layer.msg(res.data.msg);
                }
            } , err => {}).catch(( error ) => {});
        } ,
        // 收藏当前站点
        collectNowSite(){
            var data = transFormData({
                user_id : this.user_id ,
                token   : this.token ,
                site_id : this.siteid.site_id || 0
            });
            axios.post(sysurl + 'user/collectSite' , data).then(res => {
                var datas = res.data;
                if( datas.code === 1 ){
                    this.getCollectList();
                    // layer.msg(datas.msg);
                }else{
                    // layer.msg(datas.msg);
                }
            } , err => {}).catch(( error ) => {});
        } ,
        // 删除所选站点
        deleteNowSite( id ){
            var data = transFormData({
                user_id    : this.user_id ,
                token      : this.token ,
                collect_id : id
            });
            axios.post(sysurl + 'user/collectSiteDelete' , data).then(res => {
                var datas = res.data;
                if( datas.code === 1 ){
                    layer.msg(datas.msg);
                    this.getCollectList();
                }else{
                    layer.msg(datas.msg);
                }
            } , err => {}).catch(( error ) => {});
        } ,
        // 获取浏览历史
        getHistoryList(){
            var data = transFormData({
                user_id : this.user_id ,
                token   : this.token ,
                limit   : this.limit ,
                page    : this.page
            });
            axios.post(sysurl + 'user/browseSiteLogList' , data).then(res => {
                var datas = res.data;
                if( datas.code == 1 ){
                    this.historyList = datas.data.data;
                }else{
                    layer.msg(res.data.msg);
                }
            } , err => {}).catch(( error ) => {});
        },
        // 进入当前所在站点
        inNowSite( data ){
            inSite(data);
            window.localStorage.setItem("station" , JSON.stringify(data));

            if( data.site_level == 5 ){
                window.location.href = this.url + "views/home/stationC.html?siteid=" + data.site_id;
            }else{
                window.location.href = this.url + "views/home/stationB.html?siteid=" + data.site_id;
            }
        }
    } ,
    template :`<div class="public-DropMenu-drop">
                    <div class="public-DropMenu-drop-main">
                        <ul class="DropPane-drop">
                            <li class="DropPaneList HistoryList" v-for="(item,index) in collectList" :data-id="item.id" v-if="type == 'collect'">
                                <div class="text" @click="inNowSite(item)">{{item.sitename}}</div>
                                <div class="handle" @click="deleteNowSite(item.id)">删除</div>
                            </li>
                            <li class="DropPaneList HistoryList" v-for="(item,index) in historyList" :data-id="item.id" v-if="type == 'history'">
                                <div class="text" @click="inNowSite(item)">{{item.sitename}}</div>
                            </li>
                        </ul>
                        <div class="DropPane-collect" @click="collectNowSite" v-if="type == 'collect'">收藏当前站点</div>
                    </div>
                </div>`
});
// nav 搜索站点
Vue.component('navinner-component' , {
    data     : function(){
        return {
            keyword : '',
			site:'',
			siteInfo:{}
        };
    } ,
    mounted(){
		this.site = JSON.parse(window.localStorage.getItem("station")) || {};
		this.siteInfo = JSON.parse(window.localStorage.getItem("siteInfo"))
    } ,
    methods  : {
        search( type ){
            window.location.href = `../../views/home/search.html?keyword=${this.keyword}&type=${type}`;
        }
    } ,
    template : `<nav>
                    <div class="nav-top">
                        <div class="nav-le">
							
							
                            
                            <a href="../../index.html" class="logo-box">
                            	<img src="../../static/images/logo.png" style="width: 2.88rem;">
                            	<div class="name-box">
                            		<p class="jy-title">{{ site.site_id ? decodeURI(site.sitename)+siteInfo.sitename : siteInfo.sitename }}</p>
                            		<p class="jy-website">城乡阳光管理监督服务平台</p>
                            	</div>
                            	</a>
                        </div>
                        <div class="nav-ri">
                            <div class="search-box">
                                <div class="search-input">
                                    <img src="../../static/icons/搜索(1).png" alt="">
                                    <input type="text" placeholder="成都居住证办理流程" v-model="keyword">
                                    <div class="input-position" style="display: none;">
                                        <a>热门搜索：</a>
                                        <a>蓝湖橘郡</a>
                                        <a>尚品C经</a>
                                        <a>英郡icon</a>
                                    </div>
                                </div>
                                <!--<div class="search-btn" onclick="javascript:window.location.href='../../views/home/search.html'">搜索</div>-->
                                <div class="search-btn" @click="search('site')">搜索站点</div>
                                <div class="search-btn" @click="search('article')">搜索文章</div>
                            </div>
                        </div>
                    </div>
                </nav>`
});
// footer
// 底部组件
Vue.component('footer-component' , {
    data     : function(){
        return {
            navList         : [               // 底部导航列表
                { name : "关于我们" , id : 1 } ,
                { name : "家园见闻" , id : 2 } ,
                { name : "法制道德" , id : 3 } ,
                { name : "公益帮助" , id : 4 } ,
                { name : "卜咚问问" , id : 5 }
            ] ,
            wenwenList      : [                     // 问问列表
                { name : "问题列表" , url : 'views/problem/problem.html#/list?type=1' } ,
                { name : "热门问题" , url : 'views/problem/problem.html#/list?type=2' } ,
                { name : "提出问题" , url : 'views/problem/problem.html#/newquestion' } ,
                { name : "待答问题" , url : 'views/problem/problem.html#/list?type=3' }
            ] ,
            articleNavList1 : [] ,      // 家园见闻
            articleNavList2 : [] ,      // 法制道德
            articleNavList3 : [] ,      // 公益帮助
            aboutList       : "" ,           // 关于我们文章列表
            baseData        : "" ,          // 底部基础数据
            articleList     : ""          // 底部文章列表
        };
    } ,
    props    : {
        url : {
            type    : String ,
            default : "../../"
        },
        siteid : {
            type : Object ,
            default(){
                return {};
            }
        } ,
    } ,
    mounted(){
        this.getAboutList();
        this.getSiteConfig();
        this.getFooterArticle();
        this.getArticleNavList();
    } ,
    methods  : {
        getSiteConfig(){
            axios.post(sysurl + 'index/siteConfig' , {}).then(res => {
                var datas = res.data;
                if( datas.code === 1 ){
                    this.baseData = datas.data;
                }else{
                    layer.msg(res.data.msg);
                }
            } , err => {
            }).catch(( error ) => {
            });
        } ,
        // 关于我们文章列表
        getAboutList(){
            axios.post(sysurl + 'index/articleList' , { category_id : 95 , limit : 5 , page : 1 }).then(res => {
                var datas = res.data;
                if( datas.code === 1 ){
                    this.aboutList = datas.data.data;
                }else{
                    layer.msg(res.data.msg);
                }
            } , err => {
            }).catch(( error ) => {
            });
        } ,
        // 获取 家园见闻、法制道德、公益帮助导航
        getArticleNavList(){
            axios.post(sysurl + 'index/articleCategory' , transFormData({ type : 25  , site_id : this.siteid.site_id || 0 })).then(res => {
                var datas = res.data;
                if( datas.code === 1 ){
                    // 家园见闻
                    this.articleNavList1 = datas.data;
                }else{
                    layer.msg(res.data.msg);
                }
            } , err => {}).catch(( error ) => {});
            axios.post(sysurl + 'index/articleCategory' , transFormData({ type : 30  , site_id : this.siteid.site_id || 0 })).then(res => {
                var datas = res.data;
                if( datas.code === 1 ){
                    // 法制道德
                    this.articleNavList2 = datas.data;
                }else{
                    layer.msg(res.data.msg);
                }
            } , err => {}).catch(( error ) => {});
            axios.post(sysurl + 'index/articleCategory' , transFormData({ type : 36  , site_id : this.siteid.site_id || 0 })).then(res => {
                var datas = res.data;
                if( datas.code === 1 ){
                    // 公益帮助
                    this.articleNavList3 = datas.data;
                }else{
                    layer.msg(res.data.msg);
                }
            } , err => {}).catch(( error ) => {});
        } ,
        // 获取底部文章
        getFooterArticle(){
            axios.post(sysurl + 'index/footArticle' , {}).then(res => {
                var datas = res.data;
                if( datas.code === 1 ){
                    this.articleList = datas.data;
                }else{
                    layer.msg(res.data.msg);
                }
            } , err => {
            }).catch(( error ) => {
            });
        }
    } ,
    template : `<footer class="footer-base">
                    
                    <div class="footer-inner-bottom">
                        <div class="bottom-inner">
                            <div class="list-row">
                                <a :href="url+'/views/about/public.html#/detail?footer='+item.id+'&articleid='+item.id" v-for="(item,index) in articleList">{{item.name}}</a>
                            </div>
                            <p>
                                Copyright © 城乡阳光管理监督服务平台 All Rights Reserved备案号：
                                <a href="http://www.beian.gov.cn">{{baseData.beian}} </a>
                                全程技术支持：汤沐科技
                            </p>
                            <p style="margin-top: -1rem">最终解释权归{{baseData.name}}</p>
                        </div>
                    </div>
                </footer>`
});
Vue.component('footertwo-component' , {
    data     : function(){
        return {
            count : 0
        };
    } ,
    mounted(){
    } ,
    methods  : {} ,
    template : `<footer class="footer">
    <div class="footer-box">
    <div class="footer-inner-top">
        <div class="footer-item-box">
            <div class="footer-item-title">关于城乡家园服务网</div>
            <div class="footer-item-text">
                居家生活与社会服务完美链接，共创文明城市，
                共建美好家园。家家参与、便民服务、办事民主
                购物放心。

                保障社区居民利益，宣传政府政策。

                共筑中国梦
            </div>
        </div>
        <div class="footer-item-box" style="width: 5rem">
            <div class="footer-item-title">关于我们</div>
            <div class="footer-item-text">
                <a href="">网站简介</a>
                <a href="">文化理想</a>
                <a href="">服务发展</a>
                <a href="">服务公告</a>
            </div>
        </div>
        <div class="footer-item-box" style="width: 5rem">
            <div class="footer-item-title">家园见闻</div>
            <div class="footer-item-text">
                <a href="">网站简介</a>
                <a href="">文化理想</a>
                <a href="">服务发展</a>
                <a href="">服务公告</a>
            </div>
        </div>
        <div class="footer-item-box" style="width: 5rem">
            <div class="footer-item-title">道德法制</div>
            <div class="footer-item-text">
                <a href="">网站简介</a>
                <a href="">文化理想</a>
                <a href="">服务发展</a>
                <a href="">服务公告</a>
            </div>
        </div>
        <div class="footer-item-box" style="width: 5rem">
            <div class="footer-item-title">卜咚问答</div>
            <div class="footer-item-text">
                <a href="">网站简介</a>
                <a href="">文化理想</a>
                <a href="">服务发展</a>
                <a href="">服务公告</a>
            </div>
        </div>
        <div class="footer-item-box" style="width: 10rem">
            <div class="footer-item-title">联系我们</div>
            <div class="footer-item-text">
                <a href="">网站简介网站简介</a>
                <a href="">文化理想文化理想</a>
                <a href="">服务发展服务发展</a>
                <a href="">服务公告服务公告</a>
            </div>
        </div>
        <div class="footer-item-box" style="width: 15rem">
            <div class="footer-item-title">其他平台</div>
            <div class="footer-item-text">
                <div class="footer-qr-code">
                    <img src="../../static/images/图片f.png" alt="">
                    <p>安卓下载</p>
                </div>
                <div class="footer-qr-code">
                    <img src="../../static/images/图片f.png" alt="">
                    <p>服务网公众号</p>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="footer-inner-bottom">
    <div class="bottom-inner">
        <div class="list-row">
            <a href="">网站首页</a>
            <a href="">法律申明及隐私政策</a>
            <a href="">联系我们</a>
            <a href="">免责申明</a>
            <a href="">服务中心</a>
            <a href="">帮助中心</a>
        </div>
        <p>Copyright © 城乡家园服务网 All Rights Reserved备案号：蜀ICP备17003989号 全程技术支持：汤沐科技</p>
        <p style="margin-top: -1rem">最终解释权归城乡家园服务网</p>
    </div>
</div>
  </footer>`
});
// suspension
Vue.component('suspension-component' , {
    data     : function(){
        return {
            tipOffWay  : "" ,           // 投诉接口
            siteConfig : "" ,          // 站点数据
			show	   : true
        };
    } ,
    mounted(){
        // 获取站点数据
        this.getTipOffWay();
        this.getSiteConfig();
    } ,
    methods  : {
        // 投诉入口
        getTipOffWay(){
            axios.post(sysurl + 'index/tipOffWay' , {site_id:localStorage.getItem("siteInfo").site_id}).then(res => {
                if( res.data.code === 1 ){
                    this.tipOffWay = res.data.data[ 0 ];
                }else{
                    layer.msg(res.data.msg);
                }
            } , err => {
            }).catch(( error ) => {
            });
        } ,
        // 获取站点数据
        getSiteConfig(){
            axios.post(sysurl + 'index/siteConfig' , {}).then(res => {
                if( res.data.code === 1 ){
                    this.siteConfig = res.data.data;
                }else{
                    layer.msg(res.data.msg);
                }
            } , err => {
            }).catch(( error ) => {
            });
        },
		toggleshow(){
        	this.show = !this.show
		}
    } ,
    template : `<div class="suspension" :style = "'height: '+(show ? '18.38rem':'4.38rem' ) ">
                    <a href="./views/about/public.html?id=39&station_type=1&banner_type=136#/17?id=40" class="suspension-title"></a>
                    <div class="suspension-qr-code" v-if="show">
                        <img :src="siteConfig.ios_download_qrcode">
                        <p>IOS</p>
                    </div>
                    <div class="suspension-qr-code" v-if="show">
                        <img :src="siteConfig.android_download_qrcode">
                        <p>Andriod</p>
                    </div>
                   
                </div>`
});
// 友情链接
Vue.component('friend-component' , {
    data     : function(){
        return {
            list   : [] ,
			site_id:''
            // url:'http://192.168.0.168'
        };
    } ,
    props    : [ "url" ] ,
	
    mounted(){
		
		this.site_id = GetQueryString("siteid")||0
		this.getDetail();
		    
		
    } ,
    methods  : {
        getDetail : function(){
            axios.post(sysurl + 'index/friendsLink' , {site_id:this.site_id}).then(res => {
                if( res.data.code === 1 ){
                    this.list = res.data.data;
                }else{
                    layer.msg(res.data.msg);
                }
            } , err => {
            }).catch(( error ) => {
            });
        }
    } ,
    template : `<div class="friend-link">
                        <div class="link-title">
                            <a href="">友情链接</a>
                        </div>
                        <div class="adv-box">
                            <a class="adv-item" :data-id="item.id" v-for="(item,index) in list" :href="item.url" :title="item.name">
								<span v-if="item.image==null" >{{item.name}}</span>	
                                <img v-if="item.image" :src="item.image" :alt="item.name" height="38">
                            </a>
                        </div>
                    </div>`
});
// 导航列表
Vue.component('classify-component' , {
    data     : function(){
        return {
            count  : 0 ,
            top    : [] ,
            bottom : []
            // url:'http://192.168.0.168'
        };
    } ,
    mounted(){
        this.getDetail();
    } ,
    methods  : {
        getDetail : function(){
            axios.post(sysurl + 'index/navigation' , { type : 23 }).then(res => {
                if( res.data.code === 1 ){
                    this.top = res.data.data;
                }else{
                    layer.msg(res.data.msg);
                }
            } , err => {
            }).catch(( error ) => {
            });
            axios.post(sysurl + 'index/navigation' , { type : 24 }).then(res => {
                if( res.data.code === 1 ){
                    this.bottom = res.data.data;
                }else{
                    layer.msg(res.data.msg);
                }
            } , err => {
            }).catch(( error ) => {
            });
        } ,
        openLink  : function( link ){
            window.open(link);
        }
    } ,
    template : `<div class="classify-box">
                    <div class="classify-top">
                        <div class="classify-item" v-for="(t,item) in top" :key="item">
                            <a>【{{t.name}}】</a>
                            <a :href="i.url" v-for="(i,index) in t.child" :key="index" target="_blank" class="t-ellipsis">
                                <img v-if="i.iconimage!==''" class="icon-img" :src="i.iconimage_text" alt="">
                                <span>{{i.name}}</span>
                            </a>
                        </div>
                    </div>

                    <div class="classify-bottom">
                        <div class="classify-item" v-for="(t,item) in bottom" :key="item">
                            <a>【{{t.name}}】</a>
                            <a :href="i.url" v-for="(i,index) in t.child" :key="index" target="_blank" class="t-ellipsis">
                                <img v-if="i.iconimage!==''" class="icon-img" :src="i.iconimage_text" alt="">
                                <span>{{i.name}}</span>
                            </a>
                        </div>
                    </div>
                </div>`
});
//系统公告
//Vue.component('notice-component' , {
//    data     : function(){
//        return {
//            content : [] ,
//            root    : tmpsUrls + "www/static/images/圆角矩形9.png"
//
//            // url:'http://192.168.0.168'
//        };
//    } ,
//    // props:["url"],
//    mounted(){
//        this.getDetail();
//    } ,
//    methods  : {
//        getDetail : function(){
//            axios.post(sysurl + 'index/notice' , data).then(res => {
//                if( res.data.code === 1 ){
//                    this.content = res.data.data;
//                }else{
//                    layer.msg(res.data.msg);
//                }
//            } , err => {}).catch(( error ) => {});
//        }
//    } ,
//    template : `<div class="notice">
//                   <div class="notice-title">
//                       <div class="notice-logo" :style="{ backgroundImg: root}">服务公告</div>
//                   </div>
//                   <div class="notice-content">{{content.content}}</div>
//               </div>`
//});
//user
// 个人资料
Vue.component('userinfo-component' , {
    data     : function(){
        return {
            count   : 0 ,
            headimg : '' ,
            name    : '' ,
            tel     : ''
        };
    } ,
    mounted(){
        let d = new FormData;
        d.append('user_id' , getCookie('user_id'));
        d.append('token' , getCookie('token'));
        let that = this;
        axios.post(sysurl + 'user/info' , d).then(res => {
            that.headimg = res.data.data.avatar_text;
            that.name    = res.data.data.nickname;
            that.tel     = res.data.data.mobile;
        });
    } ,
    methods  : {
        changetel : function(){
            this.$emit('changetel' , 4);
        } ,
        changepwd : function(){
            this.$emit('changepwd' , 5);
        } ,
        editname  : function(){
            axios.post(sysurl + 'common/checkUsernameUnique' , { username : this.name }).then(res => {
                if( res.data.code == 1 ){
                    let s = new FormData();
                    s.append('user_id' , getCookie('user_id'));
                    s.append('token' , getCookie('token'));
                    s.append('nickname' , this.name);
                    axios.post(sysurl + 'user/profile' , s).then(res => {
                        // console.log(res);
                    });
                }else{
                    layer.msg(res.data.msg);
                }
            });
        } ,
        /**
         * 打开上传
         */
        openfile  : function(){
            document.getElementById("openfilebutton").click();
        } ,
        upload    : function( e ){
            let file = document.getElementById('openfilebutton').files[ 0 ];
            let d    = new FormData();
            d.append('file' , file);
            let that = this;
            axios.post(sysurl + 'common/upload' , d).then(res => {
                // console.log(res);
                if( res.data.code == 1 ){
                    layer.msg('上传成功');
                    that.headimg = res.data.data.show_url;
                    let s        = new FormData();
                    s.append('user_id' , getCookie('user_id'));
                    s.append('token' , getCookie('token'));
                    s.append('avatar' , res.data.data.url);
                    axios.post(sysurl + 'user/profile' , s).then(res => {
                        // console.log(res);
						this.$emit('updateinfo' , '');
                    });
                }else{
                    layer.msg(res.data.msg);
                }
            });
        }
    } ,
    template : `<div class="user-info-body user-info-detail">
                    <div class="user-info-title">个人资料</div>
                    <div class="user-info-item">
                        <div class="user-info-name">头像</div>
                        <div class="user-info-img" @click="openfile" style="cursor: pointer"> 
                            <img :src="headimg" alt="" width="82" height="82">
                            <input type="file" @change="upload" hidden id="openfilebutton">
                        </div>
                    </div>
                    <div class="user-info-item align-items-center">
                        <div class="user-info-name">登录名</div>
                        <div class="user-info-input">
                            <input type="text" v-model="name" style="height: 99%;width: 100%;border: none;outline: none;" @change="editname" maxlength="12">
                        </div>
                    </div>
                    <div class="user-info-item align-items-center">
                        <div class="user-info-name">手机号</div>
                        <div class="user-info-input">
                            {{ tel }}
                        </div>
                        <div class="modify" id="modify-mobile" @click="changetel">修改手机号</div>
                        <div class="modify" id="modify-mobile" @click="changepwd">修改密码</div>
                    </div>
                </div>`
});
// 站长资料认证
Vue.component('station-component' , {
    data     : function(){
        return {
            count       : 0 ,
            idcard      : '' ,
            showzmimg   : '' ,
            showfmimg   : '' ,
            zmimg       : '' ,
            fmimg       : '' ,
            dataimg     : '' ,
            showdataimg : '' ,
            checkdata   : '' ,
            checkStatus : ''
        };
    } ,
    mounted(){
        /**
         * 获取认证状态
         */
        this.getstatus();
    } ,
    methods  : {
        openzm : function(){
            document.getElementById('uploadzm').click();
        } ,
        openfm : function(){
            document.getElementById('uploadfm').click();
        } ,
        // 获取认证状态
        getstatus(){
            let s = new FormData();
            s.append('user_id' , getCookie('user_id'));
            s.append('token' , getCookie('token'));
            axios.post(sysurl + 'user/info' , s).then(res => {
                this.checkStatus = res.data.data.check;
                // 获取认证状态，如果没有通过则显示旧的认证信息 -没有这个需求。。
            });
        } ,
        rz     : function(){
            document.getElementById('updata').click();
        } ,
        zm     : function(){
            let file = document.getElementById('uploadzm').files[ 0 ];
            this.upload(file , 'zmimg');
        } ,
        fm     : function(){
            let file = document.getElementById('uploadfm').files[ 0 ];
            this.upload(file , 'fmimg');
        } ,
        da     : function(){
            let file = document.getElementById('updata').files[ 0 ];
            this.upload(file , 'data');
        } ,
        upload : function( file , classify ){
            let s = new FormData();
            s.append('file' , file);
            let that = this;
            axios.post(sysurl + 'common/upload' , s).then(res => {
                // console.log(res);
                if( classify == 'zmimg' ){
                    that.zmimg     = res.data.data.show_url;
                    that.showzmimg =  res.data.data.show_url;
                }else if( classify == 'fmimg' ){
                    that.fmimg     = res.data.data.show_url;
                    that.showfmimg = res.data.data.show_url;
                }else{
                    that.dataimg     = res.data.data.show_url;
                    that.showdataimg =  res.data.data.show_url;
                }
            });
        } ,
        /**
         * 选择认证类型
         */
        checkd : function( v ){
            this.checkdata = v;
        } ,
        tijiao : function(){
            // console.log(123);
            let s     = new FormData();
            let agree = $('#agree').prop('checked');
            if( agree ){
                s.append('token' , getCookie('token'));
                s.append('user_id' , getCookie('user_id'));
                s.append('card_number' , this.idcard);
                s.append('cardzimage' , this.zmimg);
                s.append('cardfimage' , this.fmimg);
                s.append('checkdata' , this.checkdata);
                s.append('room_info' , this.dataimg);
                axios.post(sysurl + 'user/siteCheck' , s).then(res => {
                    // console.log(res);
                    if( res.data.code == 1 ){
                        layer.msg('提交成功');
                        this.$emit('updateinfo' , '');
						Object.assign(this.$data, this.$options.data());
						this.getstatus();
                    }else{
                        layer.msg(res.data.msg);
                    }
                });
            }else{
                layer.msg('请保证以上信息真实性并接受（网站管理备案审查）');
            }
        }
    } ,
    template : `<div class="user-info-body Authentication-house-Add Authentication-station">
                    <div class="user-info-title">站长资料认证</div>
                    <div class="auth-house-new-item">
                        <div class="auth-house-new-name">
                            身份证号
                        </div>
                        <div class="auth-house-new-content">
                            <input type="text" class="auth-input" v-model="idcard">
                        </div>
                    </div>
                    <div class="auth-house-new-item align-items-start">
                        <div class="auth-house-new-name">
                            身份证图片
                        </div>
                        <div class="auth-house-new-content">
                            <div class="auth-house-new-content-box" @click="openzm" style="position: relative">
                            	<img :src="showzmimg" alt="" width="142" height="80" style="position: absolute;left: 0;top: 0;z-index: 2">
                                <div class="auth-house-new-img">
                                    <img src="../../static/icons/添加.png" alt="">
                                </div>
                                <div class="auth-house-new-innerText">点击上传身份证正面</div>
                                <input type="file" id="uploadzm" hidden @change="zm">
                            </div>
                            <div class="auth-house-new-content-box" @click="openfm" style="position: relative">
                            	<img :src="showfmimg" alt="" width="142" height="80" style="position: absolute;left: 0;top: 0;z-index: 2">
                                <div class="auth-house-new-img">
                                    <img src="../../static/icons/添加.png" alt="">
                                </div>
                                <div @click="openfm" class="auth-house-new-innerText">点击上传身份证反面</div>
                                <input type="file" id="uploadfm" hidden @change="fm">
                            </div>
                        </div>
                    </div>
                    <div class="auth-house-new-item align-items-start" style="margin: 2rem 0">
                        <div class="auth-house-new-name" style="width: 7rem">
                            站长职业认证
                        </div>
                        <div class="auth-house-new-content">
                            <div class="auth-list renzhengxuanze">
                            	<span @click="checkd(1)">
                            		<input type="radio" name="idcard" value="1" id="renzhen1" hidden><label for="renzhen1">当地政府证明</label>
								</span>
                            	<span @click="checkd(2)">
                            		<input type="radio" name="idcard" value="1" id="renzhen2" hidden><label for="renzhen2">营业执照</label>
                            	</span>
                            	<span @click="checkd(3)">
                            		<input type="radio" name="idcard" value="1" id="renzhen3" hidden><label for="renzhen3">单位组织证明</label>
                            	</span>
                            	<span @click="checkd(4)">
	                            	<input type="radio" name="idcard" value="1" id="renzhen4" hidden><label for="renzhen4">房屋产权书</label>
	                            </span>
                            	
                                <!--<span>当地政府证明</span>-->
                                <!--<span>营业执照</span>-->
                                <!--<span>单位组织证明</span>-->
                                <!--<span>房屋产权书</span>-->
                            </div>
                            <div class="auth-tips">（请提供以上任一证明文件）</div>
                        </div>
                    </div>
                    <div class="auth-house-new-item align-items-start">
                        <div class="auth-house-new-name">
                            &nbsp;
                        </div>
                        <div class="auth-house-new-content" @click="rz" style="position: relative;">
                        	<img :src="showdataimg" alt="" width="142" height="80" style="position: absolute;left: 0;top: 0;z-index: 2">
                            <div class="auth-house-new-content-box">
                                <div class="auth-house-new-img">
                                    <img src="../../static/icons/添加.png" alt="">
                                </div>
                                <div class="auth-house-new-innerText">点击上传认证资料</div>
                            </div>
                            <input type="file" id="updata" hidden @change="da">
                        </div>
                    </div>
                    <div class="auth-house-agreement">
                        <input type="checkbox" id="agree">我保证以上信息真实性并接受（网站管理备案审查）
                    </div>
                    <div class="auth-house-submit">
                    	<!--0=待审核,1=审核通过,2=未通过,3=未提交-->
                        <div class="submit-btn submit-btn-ccc" v-if="checkStatus==0" style="width: auto;max-width: 18rem">您已提交审核，请勿重复提交</div>
                        <div class="submit-btn" v-if="checkStatus==1">您已通过审核</div>
                        <div class="submit-btn" @click="tijiao" v-if="checkStatus==2">重新提交审核</div>
                        <div class="submit-btn" @click="tijiao" v-if="checkStatus==3">提交</div>
                    </div>
                </div>`
});
// 房产资料认证列表
Vue.component('house-component' , {
    data     : function(){
        return {
            count : 0 ,
            list  : [] ,
            page  : 1 ,
            url   : weburl ,
            total : 1 ,
            limit : 3
        };
    } ,
    mounted(){
        this.getlist();
    } ,
    methods  : {
        changetab  : function( type ){
            this.$emit('changetab' , type);
        } ,
        /**
         * 获取房产列表
         */
        getlist    : function( page ){
            page     = page || this.page;
            let s    = new FormData();
            let that = this;
            s.append('token' , getCookie('token'));
            s.append('user_id' , getCookie('user_id'));
            s.append('page' , page);
            s.append('limit' , 3);
            axios.post(sysurl + 'user/roomCheckList' , s).then(res => {
                that.list  = res.data.data.data;
                that.total = res.data.data.total;
            });
        } ,
        /**
         * del
         */
        del        : function( id ){
            let that = this;
            layer.confirm('删除之后无法恢复，确定删除吗？' , { btn : [ '确定删除' , '取消' ] } , function(){
                let d = new FormData();
                d.append('token' , getCookie('token'));
                d.append('user_id' , getCookie('user_id'));
                d.append('id' , id);
                axios.post(sysurl + 'user/deleteRoomCheck' , d).then(res => {
                    // console.log(res);
                    if( res.data.code == 1 ){
                        layer.msg('删除成功');
                        that.getlist();
                    }else{
                        layer.msg(res.data.msg);
                    }
                });
            });
        } ,
        edit       : function( id ){
            this.$emit('roomedit' , id);
        } ,
        togglePage : function( e ){
            this.page = e;
            this.getlist(e);
        }
    } ,
    template : `<div class="user-info-body Authentication-house">
                    <div class="user-info-title">房产资料认证</div>
                    <div class="auth-house-add">
                        <div class="auth-add-btn"  @click="changetab(3)">新增认证</div>
                    </div>
                    <div class="auth-house-box" v-for="item in list">
                        <div class="auth-house-name" v-if="item.status!=3">{{ item.sitename }}</div>                        
                        <div class="auth-house-name" @click="edit(item.id)" v-if="item.status==3">{{ item.sitename }}</div>                        
                        <div class="auth-house-status">
                            <div class="auth-house-status-t" v-if="item.status==1">待审核</div>
                            <div class="auth-house-status-t" v-if="item.status==2">审核通过</div>
                            <div class="auth-house-status-t active" v-if="item.status==3">未通过</div>
                        </div>
                        <div class="auth-house-item">
                            <div class="auth-house-item-img">
                                <img :src="item.room_info" alt="" onclick="showImg(this)" width="100%" height="100%">
                            </div>
                            <div class="auth-house-btn">
                                <div class="auth-house-cancel" @click="del(item.id)">删除认证</div>
                            </div>
                        </div>
                    </div>
                    <v-pagination v-if="total" :total="total" :display="limit" :currentPage="page" v-on:pagechange="togglePage"></v-pagination>                                     
                </div>`
});
// 添加房产认证
Vue.component('houseadd-component' , {
    data     : function(){
        return {
            count        : 0 ,
            idcard       : '' ,
            zmimg        : '' ,
            fmimg        : '' ,
            fcimg        : '' ,
            showzmimg    : '' ,
            showfmimg    : '' ,
            showfcimg    : '' ,
            tel          : '' ,
            room         : '' ,
            read         : false ,
            siteid       : '' ,
            areavalue    : '' ,
            site_area_id : '' ,
            area_level   : '' ,
			truecard     : 'null'
        };
    } ,
    mounted(){
        if( this.roomid ){
            this.getdetail(this.roomid);
        }
    } ,
    props    : [ 'roomid' ] ,
    methods  : {
        tijiao     : function(){
            if( this.read ){
                if( this.truecard == true ){
                    if( this.zmimg ){
                        if( this.fmimg ){
                            if( this.siteid ){
                                if( this.room ){
                                    if( (/^1[3456789]\d{9}$/.test(this.tel)) ){
                                        if( this.fcimg ){
                                            /**
                                             * 提交认证资料
                                             */
                                            let d = new FormData();
                                            d.append('token' , getCookie('token'));
                                            d.append('user_id' , getCookie('user_id'));
                                            d.append('site_id' , this.siteid);
                                            d.append('card_number' , this.idcard);
                                            d.append('cardzimage' , this.zmimg);
                                            d.append('cardfimage' , this.fmimg);
                                            d.append('room_info' , this.fcimg);
                                            d.append('room_number' , this.room);
                                            d.append('tel' , this.tel);
                                            if( this.roomid ){
                                                // 是否是编辑
                                                d.append('id' , this.roomid);
                                                axios.post(sysurl + 'user/editRoomCheck' , d).then(res => {
                                                    // console.log(res);
                                                    if( res.data.code == 1 ){
                                                        layer.msg('保存成功');
                                                        Object.assign(this.$data , this.$options.data());
                                                    }else{
                                                        layer.msg(res.data.msg);
                                                    }
                                                });
                                            }else{
                                                axios.post(sysurl + 'user/roomCheck' , d).then(res => {
                                                    // console.log(res);
                                                    if( res.data.code == 1 ){
                                                        layer.msg('提交成功');
                                                        Object.assign(this.$data , this.$options.data());
                                                    }else{
                                                        layer.msg(res.data.msg);
                                                    }
                                                });
                                            }
                                        }else{
                                            layer.msg('请上传房产认证资料');
                                        }
                                    }else{
                                        layer.msg('请输入正确的手机号');
                                    }
                                }else{
                                    layer.msg('请输入房间号');
                                }
                            }else{
                                layer.msg('请选择注册站点');
                            }
                        }else{
                            layer.msg('请上传身份证反面面');
                        }
                    }else{
                        layer.msg('请上传身份证正面');
                    }
                }else{
                    layer.msg('请输入正确的身份证号码');
                }
            }else{
                layer.msg('请保证以上信息真实性并接受（网站管理备案审查）');
            }
        } ,
        /***
         * 上传文件
         * @param file
         * @param id 根据id处理数据
         */
        upload     : function( file , id ){
            let d = new FormData();
            d.append('file' , file);
            let that = this;
            axios.post(sysurl + 'common/upload' , d).then(res => {
                // console.log(res , id);
                switch( id ){
                    case 'zm':
                        that.zmimg     = res.data.data.show_url;
                        that.showzmimg = res.data.data.show_url;
                        break;
                    case 'fm':
                        that.fmimg     = res.data.data.show_url;
                        that.showfmimg = res.data.data.show_url;
                        break;
                    case 'data':
                        that.fcimg     = res.data.data.show_url;
                        that.showfcimg = res.data.data.show_url;
                        break;
                }
            });
        } ,
        click      : function( id ){
            document.getElementById(id).click();
        } ,
        sc         : function( id ){
            // console.log(id);
            let file = document.getElementById(id).files[ 0 ];
            // console.log(file);
            this.upload(file , id);
        } ,
        /***
         * 接收子组件的信息
         */
        returncity : function( d ){
            this.areavalue = d.city;
            this.siteid    = d.id;
        } ,
        /***
         * 接收编辑参数
         */
        getdetail  : function( id ){
            let d = new FormData();
            d.append('token' , getCookie('token'));
            d.append('user_id' , getCookie('user_id'));
            d.append('id' , id);
            let that = this;
            axios.post(sysurl + 'user/checkDetail' , d).then(res => {
                // console.log(res);
                let data          = res.data.data;
                that.idcard       = data.card_number;
                that.zmimg        = data.cardzimage;
                that.showzmimg    = data.cardzimage_text;
                that.fmimg        = data.cardfimage;
                that.showfmimg    = data.cardfimage_text;
                that.areavalue    = data.area_str.split('，').join('/');
                that.checkcity    = data.area_str.split('，').join('/');
                that.room         = data.room_number;
                that.site_area_id = data.site_id;
                that.siteid       = data.site_id;
                that.fcimg        = data.room_info;
                that.showfcimg    = data.room_info_text;
                that.read         = true;
                that.tel          = data.mobile;
            });
        },
		/***
		 * 验证身份证
		 */
		trueID(){
			var reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
			if (reg.test(this.idcard)){
				this.truecard = true
			}else{
				layer.msg('请输入正确的身份证号码')
				this.truecard = false
			}
		}
    } ,
    template : `<div class="user-info-body Authentication-house-Add Authentication-new">
                    <div class="user-info-title">房产资料认证</div>
                    <div class="auth-house-new-item">
                        <div class="auth-house-new-name">
                            身份证号
                        </div>
                        <div class="auth-house-new-content">
                            <input type="text" class="auth-input" v-model="idcard" @change="trueID" :style=" 'border:' + (truecard ? '1px solid rgba(229,229,229,1)' : '1px solid red'  )">
                        </div>
                    </div>
                    <div class="auth-house-new-item align-items-start">
                        <div class="auth-house-new-name">
                            身份证图片
                        </div>
                        <div class="auth-house-new-content" style="position: relative">
                        	<img v-if="showzmimg!=''" :src="showzmimg" alt="" width="117" height="65" style="position: absolute">
                            <div class="auth-house-new-content-box" @click="click('zm')">
                                <div class="auth-house-new-img">
                                    <img src="../../static/icons/添加.png" alt="">
                                </div>
                                <div class="auth-house-new-innerText">点击上传身份证正面</div>
                                <input type="file" id="zm" hidden @change="sc('zm')">
                            </div>
                            <div class="auth-house-new-content-box" @click="click('fm')" style="position: relative">
                            	<img v-if="showfmimg!=''" :src="showfmimg" alt="" width="117" height="65" style="position: absolute">
                                <div class="auth-house-new-img">
                                    <img src="../../static/icons/添加.png" alt="">
                                </div>
                                <div class="auth-house-new-innerText">点击上传身份证反面</div>
                                <input type="file" id="fm" hidden @change="sc('fm')">
                            </div>
                        </div>
                    </div>
                    
                    <div class="auth-house-new-item">
                        <div class="auth-house-new-name">
                            选择注册站点
                        </div>
                        <div class="auth-house-new-content">
                            <input type="text" placeholder="请选择注册站点" class="auth-input register-input-name" v-model="areavalue" readonly="readonly" data-toggle="modal" data-target="#myModal2" style="width: 40.25rem; height: 2.63rem;border: 1px solid rgba(229,229,229,1); padding-left:1rem; justify-content: center; cursor: pointer;">
                        </div>
                    </div>
                    <div class="auth-house-new-item">
                        <div class="auth-house-new-name">
                            房号
                        </div>
                        <div class="auth-house-new-content">
                            <input type="text" placeholder="例：3栋2单元3039" class="auth-input" v-model="room">
                        </div>
                    </div>
                    <div class="auth-house-new-item">
                        <div class="auth-house-new-name">
                            联系电话
                        </div>
                        <div class="auth-house-new-content">
                            <input type="text" class="auth-input" v-model="tel">
                        </div>
                    </div>
                    <div class="auth-house-new-item align-items-start">
                        <div class="auth-house-new-name">
                            房产认证
                        </div>
                        <div class="auth-house-new-content">
                            <div class="auth-house-new-content-box"  @click="click('data')" style="position: relative">
                            	<img v-if="showfcimg!=''" :src="showfcimg" alt="" width="117" height="65" style="position: absolute">
                                <div class="auth-house-new-img">
                                    <img src="../../static/icons/添加.png" alt="">
                                </div>
                                <div class="auth-house-new-innerText">点击上传认证资料</div>
                                <input type="file" id="data" hidden  @change="sc('data')">
                            </div>
                        </div>
                    </div>
                    <div class="auth-house-agreement">
                        <input type="checkbox" id="checkstatus" v-model="read">我保证以上信息真实性并接受（网站管理备案审查）
                    </div>
                    <div class="auth-house-submit">
                        <div class="submit-btn" @click="tijiao">{{ roomid?"确认保存":"提交" }}</div>
                    </div>
                    <stationcheck @returncity="returncity" v-bind:type="'five'"></stationcheck>
            </div>`
});
// 修改手机号
Vue.component('changemobile-component', {
	data: function () {
		return {
			count: 0,
			tel: '',
			code: '',
			newtel: '',
			tips: '',
			oldphone:'',
			time:60,
			timeOff:true
		};
	},
	mounted() {
	},
	methods: {
		edittel: function () {
			if (this.oldphone){
				let d = new FormData();
				d.append('user_id', getCookie('user_id'));
				d.append('token', getCookie('token'));
				d.append('mobile', this.tel);
				d.append('newmobile', this.newtel);
				d.append('captcha', this.code);
				axios.post(sysurl + 'user/changemobile', d).then(res => {
					// console.log(res);
					if (res.data.code == 1) {
						layer.msg('修改成功');
					} else {
						layer.msg(res.data.msg);
					}
				});
			} else{
				layer.msg('原手机号不正确')
			}
		},
		getcode: function (obj) {
			// console.log(obj);
			sendTime(this.tel,'changemobile',this)
		},
		ispass: function () {
			let d = new FormData();
			d.append('mobile', this.tel);
			d.append('event', 'changemobile');
			d.append('captcha', this.code);
			let that = this;
			axios.post(sysurl + 'sms/check', d).then(res => {
				// console.log(res);
				if (res.data.code == 1) {
					that.tips = '';
				} else {
					that.tips = res.data.msg;
				}
			});
		},
		checkmobile(){
			let d = transFormData({
				token:getCookie('token'),
				mobile:this.tel
			});
			axios.post(sysurl+'user/checkmobile',d).then(res=>{
				if (res.data.code==1){
					this.oldphone = true
				} else{
					this.oldphone = false
					layer.msg('原手机号不正确')
				}
			})
		}
	},
	template: `<div class="user-info-body modify-mobile">
                    <div class="user-info-title" style="margin-bottom: 3rem">修改手机号</div>
                    <div class="register-input-box">
                        <div class="register-input-item">
                            <div class="register-input-name">
                                <img src="../../static/icons/手机1.png" alt="">
                                手机号
                            </div>
                            <input type="text" v-model="tel" placeholder="请输入11位手机号" @change="checkmobile">
                        </div>
                    </div>
                    <div class="register-input-box">
                        <div class="register-input-item" style="width: 31.75rem">
                            <div class="register-input-name">
                                <img src="../../static/icons/验证码.png" alt="">
                                验证码
                            </div>
                            <input type="text" v-model="code" placeholder="请输入验证码" @change="ispass">
                        </div>
                        <a href="javascript:;" @click="getcode(this)" class="verify">获取验证码<span v-if="!timeOff">({{ time }})</span> </a>
                    </div>
                    <div class="register-input-box">
                        <div class="register-input-item">
                            <div class="register-input-name">
                                <img src="../../static/icons/手机1.png" alt="">
                                手机号
                            </div>
                            <input type="text" v-model="newtel" placeholder="请输入您现在新的手机号码">
                        </div>
                    </div>
                    <p style="height: 13px;color: red;">{{ tips }}</p>
                    <div class="register-input-box" style="padding-top: 1rem">
                        <div class="register-btn" @click="edittel">提交</div>
                    </div>
                </div>`
});
// 修改密码
Vue.component('changepassword-component' , {
    data     : function(){
        return {
            count  : 0 ,
            tips   : '' ,
            oldpwd : '' ,
            newpwd : '' ,
            repeat : ''
        };
    } ,
    mounted(){
    } ,
    methods  : {
        editpwd : function(){
            if( this.oldpwd ){
                if( this.newpwd ){
                    if( this.newpwd == this.repeat ){
                        let d = new FormData();
                        d.append('user_id' , getCookie('user_id'));
                        d.append('token' , getCookie('token'));
                        d.append('newpassword' , this.newpwd);
                        d.append('oldpassword' , this.oldpwd);
                        let that = this;
                        axios.post(sysurl + 'user/resetpwds' , d).then(res => {
                            // console.log(res);
                            if( res.data.code == 1 ){
                                layer.msg('修改成功');
                                that.repeat = '';
                                that.oldpwd = '';
                                that.newpwd = '';
                            }else{
                                layer.msg(res.data.msg);
                            }
                        });
                    }else{
                        layer.msg('两次输入的密码不一致');
                    }
                }else{
                    layer.msg('请输入新密码');
                }
            }else{
                layer.msg('请输入旧密码');
            }
        }
    } ,
    template : `<div class="user-info-body modify-mobile">
                    <div class="user-info-title" style="margin-bottom: 3rem">修改密码</div>
                    <div class="register-input-box">
                        <div class="register-input-item">
                            <div class="register-input-name">
                                <img src="../../static/icons/密码(1).png" alt="">
                                旧密码
                            </div>
                            <input type="password" v-model="oldpwd" placeholder="请输入原密码" maxlength="14">
                        </div>
                    </div>
                    
                    <div class="register-input-box">
                        <div class="register-input-item">
                            <div class="register-input-name">
                                <img src="../../static/icons/密码(1).png" alt="">
                                新密码
                            </div>
                            <input type="password" v-model="newpwd" placeholder="请输入新密码" maxlength="14">
                        </div>
                    </div>
                    <div class="register-input-box">
                        <div class="register-input-item">
                            <div class="register-input-name">
                                <img src="../../static/icons/密码(1).png" alt="">
                                重复密码
                            </div>
                            <input type="password" v-model="repeat" placeholder="请重复输入密码" maxlength="14">
                        </div>
                    </div>
                    <p style="height: 13px;color: red;">{{ tips }}</p>
                    <div class="register-input-box" style="padding-top: 1rem">
                        <div class="register-btn" @click="editpwd">提交</div>
                    </div>
                </div>`
});
// 我的提问
Vue.component('ask-component' , {
    data     : function(){
        return {
            count : 0 ,
            limit : 8 ,
            page  : 1 ,
            list  : [] ,
            total : 1
        };
    } ,
    mounted(){
        this.getlist();
    } ,
    methods  : {
        getlist(){
            let d = new FormData();
            d.append('user_id' , getCookie('user_id'));
            d.append('token' , getCookie('token'));
            d.append('limit' , this.limit);
            d.append('page' , this.page);
            axios.post(sysurl + 'user/myAskingList' , d).then(res => {
                // console.log(res , '提问列表');
                this.list  = res.data.data.data;
                this.total = res.data.data.total;
            });
        } ,
        togglePage( e ){
            this.page = e;
            this.getlist(this.page);
        }
    } ,
    template : `<div class="user-info-body Problem">
                    <div class="user-info-title">我的提问</div>
                    <div class="problem-box">
                        <div class="problem-search-item" v-for="item in list">
                            <div class="problem-search-item-title">
                            	<a :href="'../problem/problem.html#/detail?id='+item.id+'&cn=%E9%97%AE%E9%97%AE%E5%88%97%E8%A1%A8&en=All%20Questions'" style="color: #000">{{ item.title }}</a>
                            </div>
                            <div class="problem-search-item-prop">
                                <span>{{ item.user.username }}</span>
                                <span>发布于：{{ item.createtime_text }}</span>
                            </div>
                            <div class="problem-search-item-text">
                                {{ item.postcontent }}
                            </div>
                            <div class="problem-search-item-option">
                                <span>{{ item.comment }}人回复</span>
                                <span>{{ item.reading }}次浏览</span>
                                <!--<span>回复</span>-->
                            </div>
                        </div>                        
                    </div>
                    <v-pagination v-if="total" :total="total" :display="limit" :currentPage="page" v-on:pagechange="togglePage"></v-pagination>
                </div>`
});
// 文章管理
Vue.component('article-component', {
	data: function () {
		return {
			count: 0,
			list: [],
			limit: 10,
			total: 1,
			page: 1
		};
	},
	mounted() {
		this.getlist()
	},
	methods: {
		getlist: function (page) {
			let d = new FormData();
			d.append('user_id', getCookie('user_id'));
			d.append('token', getCookie('token'));
			d.append('page', page || 1);
			axios.post(sysurl + 'user/articleList', d).then(res => {
				// console.log(res);
				this.list = res.data.data.data;
				this.total = res.data.data.total;
			})
		},
		hide(siteid, id, status) {
			// console.log(id);
			let d = new FormData();
			d.append('user_id', getCookie('user_id'));
			d.append('token', getCookie('token'));
			d.append('site_id', siteid);
			d.append('article_id', id);
			d.append('publishdata', status);
			let that = this;
			axios.post(sysurl + 'article/hide', d).then(res => {
				// console.log(res);
				if (res.data.code == 1) {
					let str = ''
					if (status == 1) {
						str = '隐藏成功'
					} else {
						str = '发布成功'
					}
					layer.msg(str);
					that.getlist(that.page)
				} else {
					layer.msg(res.data.msg)
				}
			});
			getFrom(d);
		},
		edit(id) {
			if (id) {
				this.$emit('articleedit', id);
			} else {
				this.$emit('articleedit', '')
			}
		},
		del(siteid, id) {
			let that = this;
			layer.confirm('删除之后无法回复，确定删除吗？', {btn: ['确定删除', '取消']}, function () {
				let d = new FormData();
				d.append('site_id', siteid);
				d.append('token', getCookie('token'));
				d.append('user_id', getCookie('user_id'));
				d.append('article_id', id);
				axios.post(sysurl + 'article/delete', d).then(res => {
					// console.log(res);
					if (res.data.code == 1) {
						layer.msg('删除成功');
						that.getlist(that.page)
					} else {
						layer.msg(res.data.msg)
					}
				})
			})
		},
		togglePage: function (e) {
			this.getlist(e)
		},
		tuisong(id){
			let d = {
				user_id:getCookie('user_id'),
				token:getCookie('token'),
				article_id:id
			};
			axios.post(sysurl+'article/push',transFormData(d)).then(res=>{
				if (res.data.code==1){
					layer.msg('推送成功');
					this.getlist(this.page)
				} else{
					layer.msg(res.data.msg)
				}
			})
		}
	},
	template:
		`<div class="user-info-body Problem">
            <div class="user-info-title">文章管理 <span class="new-article" @click="edit('add')">+新建</span></div>
            <div class="problem-box">
                <table class="table">
                     <thead>
                        <tr>
                          <th scope="col">标题</th>
                          <th scope="col" style="width: 5rem">评论</th>
                          <th scope="col" style="width: 5rem">发布者</th>
                          <th scope="col">发布时间</th>
                          <th scope="col">操作</th>
                        </tr>
                     </thead>
                     <tbody>
                       <tr v-for="item in list">
                          <td scope="row">{{ item.title }}</td>
                          <td>{{ item.comment }}</td>
                          <td>{{ item.resource }}</td>
                          <td>{{ item.publishtime_text }}</td>
                          <td>
                            <span class="option" @click="item.push==0?tuisong(item.id):''">{{ item.push==0?"向上级推送":"已推送" }}</span>
                            <span class="option" @click="item.publishdata==2 ? hide(item.site_id,item.id,1) : hide(item.site_id,item.id,2)">{{ item.publishdata == 2?'隐藏': ' 发布' }}</span>
                            <span class="option" @click="edit(item.id)">编辑</span>
                            <span class="option" @click="del(item.site_id,item.id)">删除</span>
                          </td>
                        </tr>                              
                     </tbody>
                </table>
                <v-pagination v-if="total" :total="total" :display="limit" :currentPage="page" v-on:pagechange="togglePage"></v-pagination>     
            </div>
        </div>`
});
// 发布编辑文章
Vue.component('editarticle-component' , {
    data     : function(){
        return {
            count      : 0 ,
            classlist  : [] ,
            list       : [] ,
            erjiclass  : [] ,
            erji       : '' ,
            classifyid : '' ,
            sitelist   : [] ,
            title      : '' ,
            defaultMsg : '' ,
            config     : {
                initialFrameWidth  : null ,
                initialFrameHeight : 350
            } ,
            areavalue  : '' ,
            siteid     : '' ,
            cover      : '' ,
            imgs       : []
        };
    } ,
    props    : [ 'articleid' , 'needclear'] ,
    mounted(){
		if (this.needclear){
			// console.log('需要清空');
			// console.log(this);
			Object.assign(this.$data , this.$options.data());
			// this.$refs.ue.setUEContent('');
		}else{
			if( this.articleid ){
				if( this.articleid == 'add' ){
				}else{
					/**
					 * 编辑文章
					 */
					let d = new FormData();
					d.append('article_id' , this.articleid);
					axios.post(sysurl + 'article/articleDetail' , d).then(res => {
						// console.log(res);
						let data        = res.data.data;
						this.title      = data.title;
						this.imgs       = data.coverimages.split(',');
						this.classifyid = data.first;
						this.classify();
						this.classify(this.classifyid);
						this.defaultMsg = data.postcontent;
						this.siteid     = data.site_id;
					});
				}
			}else{

			}
		}

		// this.classify();
		this.getsite();


    } ,
    methods  : {
        classify   : function( e ){
            let d = new FormData();
		
            d.append('site_id' , this.siteid);
            d.append('user_id' , getCookie('user_id'));
            d.append('token' , getCookie('token'));
            d.append('pid' , e || '');
            let that = this;
            axios.post(sysurl + 'article/category' , d).then(res => {
                // console.log(res , '文章分类');
                if( !e ){
                    that.classlist = res.data.data;
                    that.classifyid = res.data.data[0].id
                }else{
                    that.erjiclass = res.data.data;
                    that.erji      = res.data.data[ 0 ].id;
                }
            });
        } ,
        checkclass( e ){
            this.classify(e.target.value);
        } ,
        getUEContent( _this ){
            let content = _this.$refs.ue.getUEContent();
            return content;
        } ,
        tijiao     : function(){
            if( this.articleid ){
                if( this.articleid == 'add' ){
                    this.add();
                }else{
                    this.edit();
                }
            }else{
                this.add();
            }
        } ,
        edit       : function(){
            let d = new FormData();
            d.append('user_id' , getCookie('user_id'));
            d.append('token' , getCookie('token'));
            d.append('site_id' , this.siteid);
            d.append('id' , this.articleid);
            d.append('first' , this.classifyid);
            d.append('second' , this.erji);
            d.append('title' , this.title);
            d.append('coverimages' , this.imgs.join(','));
            d.append('postcontent' , this.getUEContent(this));
            axios.post(sysurl + 'article/edit' , d).then(res => {
                // console.log(res);
                if( res.data.code == 1 ){
                    layer.msg('保存成功');
                    Object.assign(this.$data , this.$options.data());
                    this.$refs.ue.setUEContent('');
                    this.classify();
                    this.getsite();
                }else{
                    layer.msg(res.data.msg);
                }
            });
        } ,
        add        : function(){
            let d = new FormData();
            d.append('user_id' , getCookie('user_id'));
            d.append('token' , getCookie('token'));
            d.append('site_id' , this.siteid);
            d.append('first' , this.classifyid);
            d.append('second' , this.erji);
            d.append('title' , this.title);
            d.append('coverimages' , this.imgs.join(','));
            d.append('postcontent' , this.getUEContent(this));
            axios.post(sysurl + 'article/add' , d).then(res => {
                // console.log(res);
                if( res.data.code == 1 ){
                    layer.msg('提交成功');
                    Object.assign(this.$data , this.$options.data());
                    this.$refs.ue.setUEContent('');
                    this.getsite();
                    this.classify();
                }else{
                    layer.msg(res.data.msg);
                }
            });
        } ,
        returncity : function( d ){
            this.areavalue = d.city;
            this.siteid    = d.id;
        } ,
        // 站点选择
        check_site( e ){
            // console.log(e.target.value);
            this.siteid = e.target.value;
			
			this.$options.methods.classify.bind(this)();
			
			
        } ,
        upload(){
            let file = document.getElementById('coverupload').files[ 0 ];
            let d    = new FormData();
            d.append('file' , file);
            let that = this;
            axios.post(sysurl + 'common/upload' , d).then(res => {
                // console.log(res);
                if( res.data.code == 1 ){
                    layer.msg('上传成功');
                    that.imgs.push(res.data.data.show_url);
                }else{
                    layer.msg(res.data.msg);
                }
            });
        } ,
        delimgs( index ){
            // console.log(index);
            this.imgs.splice(index , 1);
        } ,
        getsite(){
            let d = new FormData();
            d.append('user_id' , getCookie('user_id'));
            d.append('token' , getCookie('token'));
            axios.post(sysurl + 'user/userSite' , d).then(res => {
                // console.log(res , '我的站点');
                if( res.data.code == 1 ){
                    this.sitelist = res.data.data;
                }else{
                    layer.msg('当前未认证站点');
                }
            });
        },

    } ,

    template : `<div class="user-info-body Authentication-house-Add Authentication-station">
                    <div class="user-info-title">发布文章</div>
                    <div class="auth-house-new-item">
                        <div class="auth-house-new-name">
                            文章标题
                        </div>
                        <div class="auth-house-new-content">
                            <input type="text" class="auth-input" v-model="title">
                        </div>
                    </div>
                    <div class="auth-house-new-item">
                        <div class="auth-house-new-name">
                            选择站点
                        </div>
                        <div class="auth-house-new-content">
							<select name="" id="" v-model="siteid" @change="check_site">
								<option :value="item.site_id" v-for="item in sitelist">{{ item.sitename }}</option>	
							</select>		                        
                            <!--<input type="text" placeholder="请选择注册站点" v-model="areavalue" readonly="readonly" data-toggle="modal" data-target="#myModal2" class="auth-input register-input-name" style="width: 40.25rem; height: 2.63rem; border: 1px solid rgb(229, 229, 229); padding-left: 1rem; justify-content: center; cursor: pointer;">-->
                        </div>
                    </div>
                    <div class="auth-house-new-item">
                        <div class="auth-house-new-name">
                            选择文章分类
                        </div>
                        <div class="auth-house-new-content" style="justify-content: space-between">
                           <select name="" id="" v-model="classifyid" @change="checkclass" v-if="classlist">
                                 <option :value="cl.id" v-for="cl in classlist">{{ cl.name }}</option>
                           </select>
                           <select name="" id="" v-model="erji"  v-if="erjiclass">
                           		 <option :value="erji.id" v-for="erji in erjiclass">{{erji.name}}</option>
						   </select>
                        </div>
                    </div>
                    <div class="auth-house-new-item align-items-start">
                        <div class="auth-house-new-name">
                            上传封面
                        </div>
                        <div class="auth-house-new-content ">
                        	<img v-if="imgs.length!=0" :src="item" @click="delimgs(index)" v-for="(item,index) in imgs" alt="" width="32%" style="margin-right: 10px;">
                            <div class="auth-house-new-content-box" style="border:1px solid rgba(229,229,229,1);" v-if="imgs.length!=3">
                                <label class="auth-house-new-img" for='coverupload' style="width: 100%;height: 100%;text-align: center">
                                    <img :src="cover ? cover : '../../static/icons/add.png'" alt="" height="100%">
                                    <input type="file" hidden id="coverupload" @change="upload">
                                </label>
                            </div>
                        </div>
                    </div>
                    
                    <div class="auth-house-new-item align-items-start">
                         <div class="auth-house-new-name">
                             文章内容
                         </div>
                         <div class="auth-house-new-content">
                             <!--<textarea name="" id="" cols="30" rows="10"></textarea>-->
                             <Ueditor :defaultMsg=defaultMsg :config=config ref="ue"></Ueditor>                           
                         </div>
                     </div>
              	 	<stationcheck @returncity="returncity" v-bind:type="'five'"></stationcheck>
                    <div class="auth-house-submit">
                        <div class="submit-btn" @click="tijiao" v-if="this.sitelist.length!=0">提交</div>
                        <div class="submit-btn submit-btn-ccc" v-if="this.sitelist.length==0">未认证站点</div>
                    </div>
                </div>`
});
// 收藏文章
Vue.component('collectarticle-component' , {
    data     : function(){
        return {
            limit : 10 ,
            page  : 1 ,
            total : 1 ,
            list  : []
        };
    } ,
    mounted(){
        this.getlist();
    } ,
    methods  : {
        getlist(){
            let d = new FormData();
            d.append('user_id' , getCookie('user_id'));
            d.append('token' , getCookie('token'));
            d.append('limit' , this.limit);
            d.append('page' , this.page);
            axios.post(sysurl + 'article/collectList' , d).then(res => {
                // console.log(res , '收藏');
                this.list  = res.data.data.data;
                this.total = res.data.data.total;
            });
        } ,
        quxiao( id ){
            let d = new FormData();
            d.append('user_id' , getCookie('user_id'));
            d.append('token' , getCookie('token'));
            d.append('article_id' , id);
            axios.post(sysurl + 'article/cancelCollect' , d).then(res => {
                if( res.data.code == 1 ){
                    layer.msg('取消收藏成功');
                }else{
                    layer.msg(res.data.msg);
                }
            });
        } ,
        hide( id ){
        } ,
        togglePage( page ){
            this.page = page;
            this.getlist(this.page);
        }
    } ,
    template :
        `<div class="user-info-body Problem">
                    <div class="user-info-title">文章管理 </div>
                    <div class="problem-box">
                        <table class="table">
                             <thead>
                                <tr>
                                  <th scope="col">标题</th>
                                  <th scope="col">评论</th>
                                  <th scope="col">发布者</th>
                                  <th scope="col">发布时间</th>
                                  <th scope="col">操作</th>
                                </tr>
                             </thead>
                             <tbody>
                                <tr v-for="item in list">
                                  <td scope="row">{{ item.title }}</td>
                                  <td>{{ item.comment }}</td>
                                  <td>{{ item.author }}</td>
                                  <td>{{ item.publishtime_text }}</td>
                                  <td>
                                    <span class="option" @click="quxiao(item.id)">取消收藏</span>
                                    <!--<span class="option" @click="hide(item.id)">隐藏</span>-->
                                  </td>
                                </tr>                                
                             </tbody>
                        </table>
                        <v-pagination v-if="total" :total="total" :display="limit" :currentPage="page" v-on:pagechange="togglePage"></v-pagination>
                        
                    </div>
                </div>`
});
// 浏览历史
Vue.component('history-component', {
	data: function () {
		return {
			count: 0,
			page: 1,
			total: 1,
			limit: 10,
			list: [],
			url :''
		};
	},
	mounted() {
		this.url = location.host;
		this.getlist(this.page)
	},
	methods: {
		getlist(page) {
			let d = new FormData();
			d.append('user_id', getCookie('user_id'));
			d.append('token', getCookie('token'));
			d.append('page', page);
			axios.post(sysurl + 'article/browseLog', d).then(res => {
				// console.log(res.data, '浏览记录');
				this.list = res.data.data.data;
				this.total = res.data.data.total
			})
		},
		togglePage(e) {
			this.page = e;
			this.getlist(this.page)
		},
		clear() {
			let that = this;
			layer.confirm('确定清空历史记录吗？', {btns: ['确定', '取消']}, function () {
				let d = new FormData();
				d.append('user_id', getCookie('user_id'));
				d.append('token', getCookie('token'));
				axios.post(sysurl + 'article/browseLogDelete', d).then(res => {
					if (res.data.code == 1) {
						layer.msg('清除成功');
						that.getlist(1)
					} else {
						layer.msg(res.data.msg)
					}
				})
			})
		},
		deURL(str){
			// console.log(str);
			return location.origin+str.replace('&amp;','&')
		}
	},
	template:
		`<div class="user-info-body Problem">
            <div class="user-info-title">浏览历史 <span class="new-article" @click="clear">清空历史纪录</span></div>
            <div class="problem-box">
                <table class="table">
                     <thead v-if="list.length!=0">
                        <tr>
                          <th scope="col">标题</th>
                          <th scope="col">评论</th>
                          <th scope="col">发布者</th>
                          <th scope="col">发布时间</th>
                        </tr>
                     </thead>
                    <thead v-if="list.length==0">
                        <tr>
                            <th scope="col">没有浏览记录</th>
                        </tr>
                    </thead>
                     <tbody>
                        <tr v-for="item in list">
                          <td scope="row"><a :href="deURL(item.url)" :data-txt="url+deURL(item.url)" target="_blank">{{ item.article.title }}</a></td>
                          <td>{{ item.article.comment }}</td>
                          <td>{{ item.article.author }}</td>
                          <td>{{ item.article.publishtime_text }}</td>
                        </tr>
                     </tbody>
                </table>
                
                <v-pagination v-if="total" :total="total" :display="limit" :currentPage="page" v-on:pagechange="togglePage"></v-pagination>
                
            </div>
        </div>`
});
// 人员选举
Vue.component('vote-component' , {
    data     : function(){
        return {
            count : 0 ,
            page  : 1 ,
            list  : [] ,
            total : 1 ,
            limit : 10
        };
    } ,
    mounted(){
        this.votelist(this.page);
    } ,
    methods  : {
        changetab : function( type ){
            this.$emit('changetab' , type);
        } ,
        votelist( page ){
            let d = new FormData();
            d.append('user_id' , getCookie('user_id'));
            d.append('token' , getCookie('token'));
            d.append('limit' , this.limit);
            d.append('page' , page);
            // 1=选举，2=评议,3=活动
            d.append('type' , 1);
            axios.post(sysurl + 'vote/votePersonList' , d).then(res => {
                // console.log(res);
                if( res.data.code == 1 ){
                    this.list  = res.data.data.data;
                    this.total = res.data.data.total;
                }else{
                    layer.msg('当前进入的站点暂未认证');
                }
            });
        } ,
        togglePage( e ){
            this.page = e;
            this.votelist(this.page);
        } ,
        stop( siteid , id , publishdata ){
            let d = new FormData();
            d.append('user_id' , getCookie('user_id'));
            d.append('token' , getCookie('token'));
            d.append('site_id' , siteid);
            d.append('vote_id' , id);
            d.append('publishdata' , publishdata);
            axios.post(sysurl + 'vote/stopVoteBte' , d).then(res => {
                if( res.data.code == 1 ){
                    if( publishdata == 1 ){
                        layer.msg('启用成功');
                    }else{
                        layer.msg('暂停成功');
                    }
                    this.votelist(this.page);
                }else{
                    layer.msg(res.data.msg);
                }
            });
        } ,
        returntime( start , end ){
            let nowtime = Date.parse(new Date()) / 1000;
            let str     = '';
            if( nowtime < end ){
                let t        = end - nowtime;
                var theTime  = parseInt(t);// 需要转换的时间秒
                var theTime1 = 0;// 分
                var theTime2 = 0;// 小时
                var theTime3 = 0;// 天
                if( theTime > 60 ){
                    theTime1 = parseInt(theTime / 60);
                    theTime  = parseInt(theTime % 60);
                    if( theTime1 > 60 ){
                        theTime2 = parseInt(theTime1 / 60);
                        theTime1 = parseInt(theTime1 % 60);
                        if( theTime2 > 24 ){
                            //大于24小时
                            theTime3 = parseInt(theTime2 / 24);
                            theTime2 = parseInt(theTime2 % 24);
                        }
                    }
                }
                var result = '';
                if( theTime > 0 ){
                    // result = ""+parseInt(theTime)+"秒";
                }
                if( theTime1 > 0 ){
                    result = "" + parseInt(theTime1) + "分" + result;
                }
                if( theTime2 > 0 ){
                    result = "" + parseInt(theTime2) + "小时" + result;
                }
                if( theTime3 > 0 ){
                    result = "" + parseInt(theTime3) + "天" + result;
                }
                str = result;
            }else{
                str = '已截止';
            }
            return str;
        }
    } ,
    template :
        `<div class="user-info-body Problem">
                    <div class="user-info-title">人员选举 <span><span class="new-article" @click="changetab(12)">查看人员库</span><span class="new-article" @click="changetab(14)">+新建</span></span></div>
                    <div class="problem-box">
                        <table class="table">
                             <thead>
                                <tr>
                                  <th scope="col">标题</th>
                                  <th scope="col">发布者</th>
                                  <th scope="col">截止时间</th>
                                  <th scope="col">剩余时间</th>
                                  <th scope="col">操作</th>
                                </tr>
                             </thead>
                             <tbody>
                                <tr v-for="item in list">
                                  <td scope="row">{{ item.title }}</td>
                                  <td>{{ item.user.username }}</td>
                                  <td>{{ item.endtime_text }}</td>
                                  <td>{{ returntime(item.starttime,item.endtime) }}</td>
                                  <td>
                                    <span class="option" @click="stop(item.site_id,item.id,0)" v-if="item.publishdata==1">暂停投票</span>
                                    <span class="option" @click="stop(item.site_id,item.id,1)" v-if="item.publishdata==0">重启投票</span>
                                    <!--<span class="option">查看结果</span>-->
                                    <a :href="'../investigation/investigation.html?id=' + item.id + '&siteid=' + item.site_id + '&sitename=' + item.site.sitename +'#2'" target="_blank" class="option">查看结果</a>
                                  </td>
                                </tr>
                             </tbody>
                        </table>
                        <v-pagination v-if="total" :total="total" :display="limit" :currentPage="page" v-on:pagechange="togglePage"></v-pagination>
                    </div>
                </div>`
});

//投票列表

var activitytp = Vue.component('activitytp-component' , {
    data     : function(){
        return {
            token     : getCookie("token") ,       // 用户token
            user_id   : getCookie("user_id") ,   // 用户id
            site_data : parameter.siteid ? { site_id : parseInt(parameter.siteid) , name : decodeURI(parameter.sitename) } : ( JSON.parse(window.localStorage.getItem("station")) || {}) ,           // 站点数据
            voteList  : [] ,                // 投票数据列表
            articleList : [] ,                // 文章数据列表
            articleDetail:{},
            pagegroup : 0 ,
            total     : 0 ,
            limit     : 10 ,
            page      : 1 ,
            userinfo  : "" ,                   // 用户信息
            show      : 1 ,                        // 投票显示页面
            showPage  : 1 ,                    // 投票页面 1 ：投票列表页 2 ：投票详情页 3 ：
            sitelevel : '',
            nowItem:''
        };
    } ,
    props: [ 'defaulttag' , 'defaultid' , 'icon' ,'isfivesite','defaultway'] ,
    watch:{
        "$route":function () {

            if(this.$route.name==14||this.$route.name==15||this.$route.name==23) {
                this.show = 1
                this.togglePage(this.page);
            }

        }
    },
    mounted(){


        this.togglePage(this.page);
    } ,
    methods  : {
        // 切换分页
        togglePage(page){
            var url = "";
            var data = {};

            //if(!this.site_data || !this.site_data.site_id){
            //    layer.msg("无法获取站点信息，请选择站点后操作");
            //}
            this.page = page || this.page;
            data = transFormData({
                user_id : this.user_id ,
                token   : this.token ,
                site_id : this.site_data.site_id || 0,
                type    : this.defaultid,
                limit   : this.limit ,
                page    : this.page,
				way:this.defaultway
            });
            this.getVoteList(data);
        },
        // 获取投票列表
        getVoteList(data){
            axios.post(sysurl + 'vote/voteList' , data).then(res => {
                var datas = res.data;
                if( datas.code === 1 ){
                    this.voteList = datas.data.data;

                    if( datas.data.current_page == 1 && datas.data.total > 0 ){
                        this.total = datas.data.total;
                        this.pagegroup = datas.data.last_page;
                    }
                }else{
                    layer.msg(res.data.msg);
                }
            } , err => {}).catch(( error ) => {});
        },
        // 获取用户信息
        getUserInfo(info){

            this.userinfo = info;
        },
        goToVote(vite){
            this.show = 2
            this.nowItem = vite;


        }
    } ,
    template :
        `
<div class="article-detail-r" style="width:58rem">
                    <div class="article-header">
                        <div class="article-header-inner">
                            <div class="article-logo" style="background: none">
                                <img :src="icon" alt="" style="object-fit: cover" width="100%" height="100%">
                            </div>
                            <div class="article-tip">{{defaulttag}}</div>
                        </div>
                    </div> 
                    
                    <div class="vote-detail-r">
                    <div class="vote">
                        <div class="vote-item" v-for="(item,index) in voteList" v-if="show == 1">
                            <div class="vote-item-title">
                                <div class="vote-item-name">{{item.title}}</div>
                                <div class="vote-item-prop">截止时间：{{item.endtime_text}}</div>
                            </div>
                            <div class="vote-item-option">
<!--                                <a v-if="tabIndex == 5" :data-id="item.id" @click="goToVote(item)">查看详情</a>-->
                                <a :class="{ 'active' : item.deliberate }"  @click="goToVote(item)" >{{ item.deliberate ? '已投票' : '去投票' }}</a>
                            </div>
                        </div>

                        <v-pagination v-if="show == 1 && total" :total="total" :display="limit" :currentPage="page" :pagegroup="pagegroup" @pagechange="togglePage"></v-pagination>

                        <div class="campaign-detail-r" v-if="show == 2">
                            <runfor-component v-if="nowItem && nowItem.typedata == 1" :siteid="site_data" :vite="nowItem" @userinfo="getUserInfo"></runfor-component>

                            <activity-component v-if="nowItem && nowItem.typedata == 3" :defaultway="defaultway" :siteid="site_data" :vite="nowItem" ></activity-component>

                            <discuss-component v-if="nowItem && nowItem.typedata == 2" :siteid="site_data" :vite="nowItem"></discuss-component>

<!--                            <collect-component v-if="nowItem && nowItem.id && tabIndex == 5 " :siteid="site_data" :vite="nowItem"></collect-component>-->
                        </div>
                    </div>
                </div>
                <userdate-component v-if="userinfo" :userinfo="userinfo"></userdate-component>
                </div>

 `
});

//征集

var collectlists = Vue.component('collectlists-component' , {
    data     : function(){
        return {
            token     : getCookie("token") ,       // 用户token
            user_id   : getCookie("user_id") ,   // 用户id
            site_data : parameter.siteid ? { site_id : parseInt(parameter.siteid) , name : decodeURI(parameter.sitename) } : ( JSON.parse(window.localStorage.getItem("station")) || {}) ,           // 站点数据
            voteList  : [] ,// 投票数据列表
            articleList : [] ,                // 文章数据列表
            articleDetail:{},
            pagegroup : 0 ,
            total     : 0 ,
            limit     : 10 ,
            page      : 1 ,
            userinfo  : "" ,                   // 用户信息
            show      : 1 ,                        // 投票显示页面
            showPage  : 1 ,                    // 投票页面 1 ：投票列表页 2 ：投票详情页 3 ：
            sitelevel : '',
            nowItem:''
        };
    } ,
    props: [ 'defaulttag' , 'defaultid' , 'icon' ,'isfivesite'] ,
    watch:{
        "$route":function () {


            if(this.$route.name==16) {
                this.show = 1
                this.togglePage(this.page);
            }

        }
    },
    mounted(){


        this.togglePage(this.page);
    } ,
    methods  : {
        // 切换分页
        togglePage(page){
            var url = "";
            var data = {};

            //if(!this.site_data || !this.site_data.site_id){
            //    layer.msg("无法获取站点信息，请选择站点后操作");
            //}
            this.page = page || this.page;
            data = transFormData({
                user_id : this.user_id ,
                token   : this.token ,
                site_id : this.site_data.site_id || 0,
                type    : this.defaultid,
                limit   : this.limit ,
                page    : this.page
            });
            this.getVoteList(data);
        },
        // 获取投票列表
        getVoteList(data){
            axios.post(sysurl + 'vote/collect' , data).then(res => {
                var datas = res.data;
                if( datas.code === 1 ){
                    this.voteList = datas.data.data;

                    if( datas.data.current_page == 1 && datas.data.total > 0 ){
                        this.total = datas.data.total;
                        this.pagegroup = datas.data.last_page;
                    }
                }else{
                    layer.msg(res.data.msg);
                }
            } , err => {}).catch(( error ) => {});
        },
        // 获取用户信息
        getUserInfo(info){

            this.userinfo = info;
        },
        goToVote(vite){
            this.show = 2
            this.nowItem = vite;


        }
    } ,
    template :
        `
<div class="article-detail-r" style="width:58rem">
                    <div class="article-header">
                        <div class="article-header-inner">
                            <div class="article-logo" style="background: none">
                                <img :src="icon" alt="" style="object-fit: cover" width="100%" height="100%">
                            </div>
                            <div class="article-tip">{{defaulttag}}</div>
                        </div>
                    </div> 
                    
                    <div class="vote-detail-r">
                    <div class="vote">
                        <div class="vote-item" v-for="(item,index) in voteList" v-if="show == 1">
                            <div class="vote-item-title">
                                <div class="vote-item-name">{{item.title}}</div>
                                <div class="vote-item-prop">截止时间：{{item.endtime_text}}</div>
                            </div>
                            <div class="vote-item-option">
                                <a :data-id="item.id" @click="goToVote(item)">查看详情</a>
<!--                                <a :class="{ 'active' : item.deliberate }"  @click="goToVote(item)" >{{ item.deliberate ? '已投票' : '去投票' }}</a>-->
                            </div>
                        </div>

                        <v-pagination v-if="show == 1 && total" :total="total" :display="limit" :currentPage="page" :pagegroup="pagegroup" @pagechange="togglePage"></v-pagination>

                        <div class="campaign-detail-r" v-if="show == 2">
<!--                            <runfor-component v-if="nowItem && nowItem.typedata == 1" :siteid="site_data" :vite="nowItem" @userinfo="getUserInfo"></runfor-component>-->

<!--                            <activity-component v-if="nowItem && nowItem.typedata == 3" :siteid="site_data" :vite="nowItem" ></activity-component>-->

<!--                            <discuss-component v-if="nowItem && nowItem.typedata == 2" :siteid="site_data" :vite="nowItem"></discuss-component>-->

                            <collect-component v-if="nowItem && nowItem.id" :siteid="site_data" :vite="nowItem"></collect-component>
                        </div>
                    </div>
                </div>
                <userdate-component v-if="userinfo" :userinfo="userinfo"></userdate-component>
                </div>

 `
});


// 活动投票
var support = Vue.component('support-component' , {
    data     : function(){
        return {
            count : 0 ,
            list  : [] ,
            page  : 1 ,
            limit : 10 ,
            total : 1
        };
    } ,
    mounted(){
        this.getlist(this.page);
    } ,
    methods  : {
        changetab : function( type ){
            this.$emit('changetab' , type);
        } ,
        getlist( page ){
            let d = new FormData();
            d.append('user_id' , getCookie('user_id'));
            d.append('token' , getCookie('token'));
            // 1=选举，2=评议,3=活动
            d.append('type' , 3);
            axios.post(sysurl + 'vote/votePersonList' , d).then(res => {
                // console.log(res , '活动投票列表');
                this.list  = res.data.data.data;
                this.total = res.data.data.total;
            });
        } ,
        returntime( end ){
            let nowtime = Date.parse(new Date()) / 1000;
            let str     = '';
            if( nowtime < end ){
                let t        = end - nowtime;
                var theTime  = parseInt(t);// 需要转换的时间秒
                var theTime1 = 0;// 分
                var theTime2 = 0;// 小时
                var theTime3 = 0;// 天
                if( theTime > 60 ){
                    theTime1 = parseInt(theTime / 60);
                    theTime  = parseInt(theTime % 60);
                    if( theTime1 > 60 ){
                        theTime2 = parseInt(theTime1 / 60);
                        theTime1 = parseInt(theTime1 % 60);
                        if( theTime2 > 24 ){
                            //大于24小时
                            theTime3 = parseInt(theTime2 / 24);
                            theTime2 = parseInt(theTime2 % 24);
                        }
                    }
                }
                var result = '';
                if( theTime > 0 ){
                    // result = ""+parseInt(theTime)+"秒";
                }
                if( theTime1 > 0 ){
                    result = "" + parseInt(theTime1) + "分" + result;
                }
                if( theTime2 > 0 ){
                    result = "" + parseInt(theTime2) + "小时" + result;
                }
                if( theTime3 > 0 ){
                    result = "" + parseInt(theTime3) + "天" + result;
                }
                str = result;
            }else{
                str = '已截止';
            }
            return str;
        } ,
        stop( siteid , id , publishdata ){
            let d = new FormData();
            d.append('user_id' , getCookie('user_id'));
            d.append('token' , getCookie('token'));
            d.append('site_id' , siteid);
            d.append('vote_id' , id);
            d.append('publishdata' , publishdata);
            axios.post(sysurl + 'vote/stopVoteBte' , d).then(res => {
                // console.log(res);
                if( res.data.code == 1 ){
                    if( publishdata == 1 ){
                        layer.msg('重启成功');
                    }else{
                        layer.msg('暂停成功');
                    }
                    this.getlist(this.page);
                }else{
                    layer.msg(res.data.msg);
                }
            });
        } ,
        togglePage( e ){
            this.page = e;
            this.getlist(this.page);
        }
    } ,
    template :
        `<div class="user-info-body Problem">
                    <div class="user-info-title">活动投票 <span class="new-article" @click="changetab(15)">+新建</span></div>
                    <div class="problem-box">
                        <table class="table">
                             <thead>
                                <tr>
                                  <th scope="col">标题</th>
                                  <th scope="col">发布者</th>
                                  <th scope="col">截止时间</th>
                                  <th scope="col">剩余时间</th>
                                  <th scope="col">操作</th>
                                </tr>
                             </thead>
                             <tbody>
                                <tr v-for="item in list">
                                  <td scope="row">{{ item.title }}</td>
                                  <td>{{ item.user.nickname }}</td>
                                  <td>{{ item.endtime_text }}</td>
                                  <td>{{ returntime(item.endtime) }}</td>
                                  <td>
                                    <span class="option" v-if="item.publishdata==1" @click="stop(item.site_id,item.id,0)">暂停投票</span>
                                    <span class="option" v-if="item.publishdata!=1" @click="stop(item.site_id,item.id,1)">重启投票</span>
                                    <!--<span class="option">查看结果</span>-->
                                    <a :href="'../investigation/investigation.html#4?id='+item.id+'&siteid='+item.site_id+'&sitename='+item.site.sitename" target="_blank" class="option">查看结果</a>
                                  </td>
                                </tr>
                             </tbody>
                        </table>
                        <v-pagination v-if="total" :total="total" :display="limit" :currentPage="page" v-on:pagechange="togglePage"></v-pagination>
                        
                    </div>
                </div>`
});
// 事件评议
Vue.component('appraise-component' , {
    data     : function(){
        return {
            count  : 0 ,
            total  : 1 ,
            page   : 1 ,
            limit  : 10 ,
            list   : [] ,
            siteid : ''
        };
    } ,
    filters  : {
        time( end ){
            let nowtime = Date.parse(new Date()) / 1000;
            let str     = '';
            if( nowtime < end ){
                let t        = end - nowtime;
                var theTime  = parseInt(t);// 需要转换的时间秒
                var theTime1 = 0;// 分
                var theTime2 = 0;// 小时
                var theTime3 = 0;// 天
                if( theTime > 60 ){
                    theTime1 = parseInt(theTime / 60);
                    theTime  = parseInt(theTime % 60);
                    if( theTime1 > 60 ){
                        theTime2 = parseInt(theTime1 / 60);
                        theTime1 = parseInt(theTime1 % 60);
                        if( theTime2 > 24 ){
                            //大于24小时
                            theTime3 = parseInt(theTime2 / 24);
                            theTime2 = parseInt(theTime2 % 24);
                        }
                    }
                }
                var result = '';
                if( theTime > 0 ){
                    // result = ""+parseInt(theTime)+"秒";
                }
                if( theTime1 > 0 ){
                    result = "" + parseInt(theTime1) + "分" + result;
                }
                if( theTime2 > 0 ){
                    result = "" + parseInt(theTime2) + "小时" + result;
                }
                if( theTime3 > 0 ){
                    result = "" + parseInt(theTime3) + "天" + result;
                }
                str = result;
            }else{
                str = '已截止';
            }
            return str;
        }
    } ,
    mounted(){
        let d = {
            user_id : getCookie('user_id') ,
            token   : getCookie('token')
        };
        d     = transFormData(d);
        axios.post(sysurl + 'user/userSite' , d).then(res => {
            if( res.data.data.length ){
                this.siteid = res.data.data[ 0 ].site_id;
                this.getlist(this.page);
            }else{
                layer.msg('无法获取当前站点信息');
            }
        });
    } ,
    methods  : {
        changetab : function( type ){
            this.$emit('changetab' , type);
        } ,
        getlist( page ){
            let d = new FormData();
            d.append('token' , getCookie('token'));
            d.append('user_id' , getCookie('user_id'));
            d.append('page' , page);
            d.append('site_id' , this.siteid);
            d.append('limit' , this.limit);
            // 1=选举，2=评议,3=活动
            d.append('type' , 2);
            axios.post(sysurl + 'vote/votePersonList' , d).then(res => {
                // console.log(res);
                this.list  = res.data.data.data;
                this.total = res.data.data.total;
            });
        } ,
        stop( siteid , id , type ){
            let d = new FormData();
            d.append('token' , getCookie('token'));
            d.append('user_id' , getCookie('user_id'));
            d.append('site_id' , siteid);
            d.append('vote_id' , id);
            d.append('publishdata' , type);
            axios.post(sysurl + 'vote/stopVoteBte' , d).then(res => {
                if( res.data.code == 1 ){
                    if( type == 1 ){
                        layer.msg('重启成功');
                    }else{
                        layer.msg('暂停成功');
                    }
                    this.getlist(this.page);
                }else{
                    layer.msg(res.data.msg);
                }
            });
        } ,
        togglePage( e ){
            this.page = e;
            this.getlist(this.page);
        } ,
        returntime( end ){
            let nowtime = Date.parse(new Date()) / 1000;
            let str     = '';
            if( nowtime < end ){
                let t        = end - nowtime;
                var theTime  = parseInt(t);// 需要转换的时间秒
                var theTime1 = 0;// 分
                var theTime2 = 0;// 小时
                var theTime3 = 0;// 天
                if( theTime > 60 ){
                    theTime1 = parseInt(theTime / 60);
                    theTime  = parseInt(theTime % 60);
                    if( theTime1 > 60 ){
                        theTime2 = parseInt(theTime1 / 60);
                        theTime1 = parseInt(theTime1 % 60);
                        if( theTime2 > 24 ){
                            //大于24小时
                            theTime3 = parseInt(theTime2 / 24);
                            theTime2 = parseInt(theTime2 % 24);
                        }
                    }
                }
                var result = '';
                if( theTime > 0 ){
                    // result = ""+parseInt(theTime)+"秒";
                }
                if( theTime1 > 0 ){
                    result = "" + parseInt(theTime1) + "分" + result;
                }
                if( theTime2 > 0 ){
                    result = "" + parseInt(theTime2) + "小时" + result;
                }
                if( theTime3 > 0 ){
                    result = "" + parseInt(theTime3) + "天" + result;
                }
                str = result;
            }else{
                str = '已截止';
            }
            return str;
        }
    } ,
    template :
        `<div class="user-info-body Problem">
                    <div class="user-info-title">事件评议 <span class="new-article" @click="changetab(16)">+新建</span></div>
                    <div class="problem-box">
                        <table class="table">
                             <thead>
                                <tr>
                                  <th scope="col">标题</th>
                                  <th scope="col">发布者</th>
                                  <th scope="col">截止时间</th>
                                  <th scope="col">剩余时间</th>
                                  <th scope="col">操作</th>
                                </tr>
                             </thead>
                             <tbody>
                                <tr v-for="item in list">
                                  <td scope="row">{{ item.title }}</td>
                                  <td>{{ item.user.nickname }}</td>
                                  <td>{{ item.endtime_text }}</td>
                                  <td>{{ item.endtime | time }}</td>
                                  <td>
                                    <span class="option" v-if="item.publishdata==1" @click="stop(item.site_id,item.id,0)">暂停投票</span>
                                    <span class="option" v-if="item.publishdata==0" @click="stop(item.site_id,item.id,1)">重启投票</span>
                                    <!--<span class="option">查看结果</span>-->
                                    <a :href="'../investigation/investigation.html#3&id='+item.id+'&siteid='+item.site_id+'&sitename='+item.site.sitename+''" target="_blank" class="option">查看结果</a>
                                  </td>
                                </tr>                               
                             </tbody>
                        </table>
                        
                        <v-pagination v-if="total" :total="total" :display="limit" :currentPage="page" v-on:pagechange="togglePage"></v-pagination>
                    </div>
                </div>`
});
// 查看人员库
Vue.component('personnel-component' , {
    data     : function(){
        return {
            count  : 0 ,
            siteid : '' ,
            list   : [] ,
            page   : 1 ,
            total  : 1 ,
            limit  : 18
        };
    } ,
    mounted(){
        let d = {
            user_id : getCookie('user_id') ,
            token   : getCookie('token')
        };
        d     = transFormData(d);
        axios.post(sysurl + 'user/userSite' , d).then(res => {
            if( res.data.data.length ){
                this.siteid = res.data.data[ 0 ].site_id;
                this.getlist(this.page);
            }else{
                layer.msg('无法获取当前站点信息');
            }
        });
    } ,
    methods  : {
        changetab : function( type ){
            this.$emit('changetab' , type);
        } ,
        getlist( page ){
            let d = new FormData();
            d.append('user_id' , getCookie('user_id'));
            d.append('token' , getCookie('token'));
            d.append('site_id' , this.siteid);
            d.append('limit' , this.limit);
            d.append('page' , this.page);
            axios.post(sysurl + 'vote/campaignData' , d).then(res => {
                // console.log(res , res.data.data.total);
                this.list  = res.data.data.data;
                this.total = res.data.data.total;
            });
        } ,
        showImg( obj ){
            var src = obj;
            $(".modal-img").attr("src" , src);
            $('#myModal3').modal('show').on('shown.bs.modal' , function( e ){
            });
        } ,
        del( id , siteid ){
            let that = this;
            layer.confirm('删除之后无法恢复，确认删除吗？' , { btns : [ '确认删除' , '取消' ] } , function(){
                let d = new FormData();
                d.append('user_id' , getCookie('user_id'));
                d.append('token' , getCookie('token'));
                d.append('site_id' , siteid);
                d.append('id' , id);
                axios.post(sysurl + 'vote/campaignDelete' , d).then(res => {
                    if( res.data.code == 1 ){
                        layer.msg('删除成功');
                        that.getlist(this.page);
                    }else{
                        layer.msg(res.data.msg);
                    }
                });
            });
        } ,
        togglePage( e ){
            this.page = e;
            this.getlist(e);
        }
    }
    ,
    template : `<div class="user-info-body Problem">
                    <div class="user-info-title">人员库 <span class="new-article" @click="changetab(13)">+新建</span></div>
                    <div class="problem-box">
                         <div class="campaign-item-content">
                            <div class="campaign-item-inner" v-for="item in list">
                                <div class="campaign-item-img" @click="showImg(item.avatar_text)" data-toggle="modal" data-target="#myModal" style="background:none">
									<img :src="item.avatar_text" alt=""> 
								</div>
                                <div class="campaign-item-name">{{ item.name }}</div>
                                <div class="campaign-item-intro" :title="item.introduction">{{ item.introduction }}</div>
                                <div class="campaign-item-btn">
                                    <span @click="del(item.id,item.site_id)">删除</span>
                                </div>
                            </div>                            
                        </div>
                        <v-pagination v-if="total" :total="total" :display="limit" :currentPage="page" v-on:pagechange="togglePage"></v-pagination>
                    </div>
                </div>`
});
// 新建人员
Vue.component('addperson-component' , {
    data     : function(){
        return {
            count        : 0 ,
            siteid       : '' ,
            name         : '' ,
            age          : '' ,
            nation       : '' ,
            politic      : 1 ,
            introduction : '' ,
            avatar       : '' ,
            job          : '' ,
            showimg      : '' ,
            type      	 : 1 ,
            url          : '',
            info         : {},
        };
    } ,
    mounted(){
        let d = {
            user_id : getCookie('user_id') ,
            token   : getCookie('token')
        };
        d     = transFormData(d);
        axios.post(sysurl + 'user/userSite' , d).then(res => {
            if( res.data.data.length ){
                this.siteid = res.data.data[ 0 ].site_id;
            }else{
                layer.msg('无法获取当前站点信息');
            }
        });
		
		var formdata = new FormData();
		formdata.append("user_id" , getCookie('user_id'));
		formdata.append("token" , getCookie('token'));
		axios.post(sysurl + 'user/info' , formdata).then(res => {
		    if( res.data.code === 1 ){
		        this.info = res.data.data;
		        
		    }else{
		        // layer.msg(res.data.msg);
		    }
		} , err => {}).catch(( error ) => {});
    } ,
    methods  : {
        upload(){
            let file = document.getElementById('upload').files[ 0 ];
            let d    = new FormData();
            d.append('file' , file);
            axios.post(sysurl + 'common/upload' , d).then(res => {
                // console.log(res);
                if( res.data.code == 1 ){
                    layer.msg('上传成功');
                    this.avatar  = res.data.data.url;
                    this.showimg = res.data.data.show_url;
                }else{
                    layer.msg(res.data.msg);
                }
            });
        } ,
        click(){
            document.getElementById('upload').click();
        } ,
        tijiao(){
            let d = new FormData();
            d.append('user_id' , getCookie('user_id'));
            d.append('token' , getCookie('token'));
            d.append('site_id' , this.siteid);
            d.append('name' , this.name);
            d.append('age' , this.age);
            d.append('nation' , this.nation);
            d.append('politic' , this.politic);
            d.append('introduction' , this.introduction);
            d.append('avatar' , this.avatar);
            d.append('job' , this.job);
            d.append('type' , this.type);
            axios.post(sysurl + 'vote/campaignAdd' , d).then(res => {
                // console.log(res);
                if( res.data.code == 1 ){
                    layer.msg('添加成功');
                    Object.assign(this.$data , this.$options.data());
                    this.siteid = JSON.parse(localStorage.getItem('station')).site_id;
                }else{
                    layer.msg(res.data.msg);
                }
            });
        }
    } ,
    template : `<div class="user-info-body Authentication-house-Add Authentication-station">
                    <div class="user-info-title">新建人员</div>
                    <div class="auth-house-new-item">
                        <div class="auth-house-new-name">
                            人员姓名
                        </div>
                        <div class="auth-house-new-content">
                            <input type="text" class="auth-input" v-model=" name" >
                        </div>
                    </div>
                     <div class="auth-house-new-item align-items-start">
                        <div class="auth-house-new-name">
                            上传头像
                        </div>
                        <div class="auth-house-new-content">
                            <div class="auth-house-new-content-box" style="border:1px solid rgba(229,229,229,1);width: 5rem;height: 5rem" @click="click">
                                <div class="auth-house-new-img">
                                    <!--<img src="../../static/icons/add.png" alt="">-->
                                    <img :src="showimg ? showimg : '../../static/icons/add.png'" alt="" style="max-width: 66px;">
                                    <input type="file" @change="upload" id="upload" hidden>
                                </div>
                               
                            </div>
                           
                        </div>
                    </div>
                     <div class="auth-house-new-item">
                        <div class="auth-house-new-name">
                            职位
                        </div>
                        <div class="auth-house-new-content">
                            <input type="text" class="auth-input" v-model=" job ">
                        </div>
                    </div>
                    <div class="auth-house-new-item">
                        <div class="auth-house-new-name">
                            年龄
                        </div>
                        <div class="auth-house-new-content">
                            <input type="text" class="auth-input" v-model=" age ">
                        </div>
                    </div>
                    <div class="auth-house-new-item">
                        <div class="auth-house-new-name">
                            政治面貌
                        </div>
                        <div class="auth-house-new-content">
                        	<select name="" id="" v-model="politic ">
                        		<option value="1">群众</option>
                        		<option value="2">团员</option>
                        		<option value="3">党员</option>
							</select>
                        </div>
                    </div>
					<div class="auth-house-new-item">
					    <div class="auth-house-new-name">
					        发布区域
					    </div>
					    <div class="auth-house-new-content">
					    	<select name="" id="" v-model="type">
					    		<option value="1">家园调查</option>
					    		<option value="2" v-if="info.group_id == 2||info.group_id == 7" >业主管理</option>
							</select>
					    </div>
					</div>
                    <div class="auth-house-new-item">
                        <div class="auth-house-new-name">
                            民族
                        </div>
                        <div class="auth-house-new-content">
                            <input type="text" class="auth-input" v-model="nation ">
                        </div>
                    </div>
                   
                    
                   <div class="auth-house-new-item align-items-start">
                        <div class="auth-house-new-name">
                            人物介绍
                        </div>
                        <div class="auth-house-new-content">
                            <textarea name="" id="" cols="30" rows="10" v-model=" introduction "></textarea>
                        </div>
                    </div>
              
                    <div class="auth-house-submit">
                        <div class="submit-btn" @click="tijiao">提交</div>
                    </div>
                </div>`
});
// 新建投票
Vue.component('newvote-component' , {
    data     : function(){
        return {
            count     : 0 ,
            siteid    : '' ,
            list      : [] ,
            checklist : [] ,
            title     : '' ,
            ticket    : '' ,
            endtime   : '',
			info         : {},
			type:1
        };
    } ,
    created(){
        // let that = this;
        // const sdk = document.createElement('script');
        // sdk.type = 'text/javascript';
        // sdk.src = "../../libs/layer-v3.1.1/laydate/laydate.js";
        // sdk.onload = function() {
        // 	console.log('加载了时间组件');
        // };
        // document.body.appendChild(sdk)
    } ,
    mounted(){
        let d = {
            user_id : getCookie('user_id') ,
            token   : getCookie('token')
        };
        d     = transFormData(d);
        axios.post(sysurl + 'user/userSite' , d).then(res => {
            if( res.data.data.length ){
                this.siteid = res.data.data[ 0 ].site_id;
                this.getlist(this.page);
            }else{
                layer.msg('无法获取当前站点信息');
            }
        });
		var formdata = new FormData();
		formdata.append("user_id" , getCookie('user_id'));
		formdata.append("token" , getCookie('token'));
		axios.post(sysurl + 'user/info' , formdata).then(res => {
		    if( res.data.code === 1 ){
		        this.info = res.data.data;
		        
		    }else{
		        // layer.msg(res.data.msg);
		    }
		} , err => {}).catch(( error ) => {});
    } ,
    methods  : {
        read(){
            laydate.render({
                elem   : '#newvote_check_time' , //指定元素
                type   : 'datetime' ,
                change : function( value , date , endDate ){
                    // console.log(value); //得到日期生成的值，如：2017-08-18
                    // console.log(date); //得到日期时间对象：{year: 2017, month: 8, date: 18, hours: 0, minutes: 0, seconds: 0}
                    // console.log(endDate); //得结束的日期时间对象，开启范围选择（range: true）才会返回。对象成员同上。
                    this.endtime = value;
                    // console.log(this);
                }
            });
        } ,
        getlist( page ){
            let d = new FormData();
            d.append('user_id' , getCookie('user_id'));
            d.append('token' , getCookie('token'));
            d.append('site_id' , this.siteid);
            d.append('page' , page);
			
            axios.post(sysurl + 'vote/campaignData' , d).then(res => {
                // console.log(res);
                this.list  = res.data.data.data;
                this.total = res.data.data.total;
                this.read();
            });
        } ,
        checkthis( item , index , id ){
            // console.log(item.active , index , id);
            if( item.active ){
                Vue.set(item , 'active' , false);
                this.checklist.splice(this.checklist.indexOf(id) , 1);
            }else{
                Vue.set(item , 'active' , true);
                this.checklist.push(id);
            }
            // console.log(this.checklist);
        } ,
        tijiao(){
            let d = new FormData();
            d.append('user_id' , getCookie('user_id'));
            d.append('token' , getCookie('token'));
            d.append('site_id' , this.siteid);
            d.append('endtime' , $('#newvote_check_time').val());
            d.append('title' , this.title);
            d.append('vote_limit' , this.ticket);
            d.append('campaign_id' , this.checklist.join(','));
			d.append('type' , this.type);
            axios.post(sysurl + 'vote/campaignVoteAdd' , d).then(res => {
                // console.log(res);
                if( res.data.code == 1 ){
                    layer.msg('新建选举成功');
                    $('#newvote_check_time').val('');
                    Object.assign(this.$data , this.$options.data());
                }else{
                    layer.msg(res.data.msg);
                }
            });
        }
    } ,
    template : `<div class="user-info-body Authentication-house-Add Authentication-station">
                    <div class="user-info-title">新建人员选举</div>
                    <p class="new-tip">tip：新建人员会自动储存进人员库</p>
                    <div class="auth-house-new-item">
                        <div class="auth-house-new-name">
                            投票标题
                        </div>
                        <div class="auth-house-new-content">
                            <input type="text" class="auth-input" v-model="title">
                        </div>
                    </div>
                    
                     <div class="auth-house-new-item">
                        <div class="auth-house-new-name">
                            设置用户投票数
                        </div>
                        <div class="auth-house-new-content">
                            <input type="number" class="auth-input" v-model="ticket">
                        </div>
                    </div>
                    <div class="auth-house-new-item">
                        <div class="auth-house-new-name">
                            投票截止时间
                        </div>
                        <div class="auth-house-new-content">
                            <input type="text" class="auth-input" id="newvote_check_time" readonly>
                        </div>
                    </div>
					<div class="auth-house-new-item">
					    <div class="auth-house-new-name">
					        发布区域
					    </div>
					    <div class="auth-house-new-content">
					    	<select name="" id="" v-model="type">
					    		<option value="1">家园调查</option>
					    		<option value="2" v-if="info.group_id == 2||info.group_id == 7" >业主管理</option>
							</select>
					    </div>
					</div>
                    <div class="auth-house-new-item align-items-start">
                        <div class="auth-house-new-name">
                            选择投票人员
                        </div>
                        <div class="auth-house-new-content" style="width: 40.25rem;flex-wrap: wrap">
                            <div class="vote-persion-item" v-for="(item,index) in list" @click="checkthis(item,index,item.id)" :class="{'active':item.active}">
                                <img alt="" :src="item.avatar_text">
                                {{ item.name }}
                            </div>
                            <!-- 已列出全部的人员，不需要查看 -->
                            <!--<div class="vote-persion-item" style="cursor: pointer;background: #eee">-->
                                <!--<img src="../../static/images/add1.png" alt="" style="object-fit: none;height: 100%">-->
                            <!--</div>-->
                        </div>
                    </div>
                    <div class="auth-house-submit">
                        <div class="submit-btn" @click="tijiao">提交</div>
                    </div>
                </div>`
});
// 新建活动投票
Vue.component('newactivity-component' , {
    data     : function(){
        return {
            count  : 0 ,
            title  : '' ,
            event  : '' ,
            siteid : '',
			info         : {},
			type:1
        };
    } ,
    mounted(){
        laydate.render({
            elem : '#new_event_time_input' , //指定元素
            type : 'datetime'
        });
        let d = {
            user_id : getCookie('user_id') ,
            token   : getCookie('token')
        };
        d     = transFormData(d);
        axios.post(sysurl + 'user/userSite' , d).then(res => {
            if( res.data.data.length ){
                this.siteid = res.data.data[ 0 ].site_id;
            }else{
                layer.msg('无法获取当前站点信息');
            }
        });
		var formdata = new FormData();
		formdata.append("user_id" , getCookie('user_id'));
		formdata.append("token" , getCookie('token'));
		axios.post(sysurl + 'user/info' , formdata).then(res => {
		    if( res.data.code === 1 ){
		        this.info = res.data.data;
		        
		    }else{
		        // layer.msg(res.data.msg);
		    }
		} , err => {}).catch(( error ) => {});
    } ,
    methods  : {
        tijiao(){
            let d = new FormData();
            d.append('user_id' , getCookie('user_id'));
            d.append('token' , getCookie('token'));
            d.append('site_id' , this.siteid);
            d.append('title' , this.title);
            d.append('endtime' , $('#new_event_time_input').val());
            d.append('content' , this.event);
			d.append('type' , this.type);
            axios.post(sysurl + 'vote/activeVoteAdd' , d).then(res => {
                if( res.data.code == 1 ){
                    layer.msg('创建成功');
                    Object.assign(this.$data , this.$options.data());
                    $('#new_event_time_input').val('');
                }else{
                    layer.msg(res.data.msg);
                }
            });
        }
    } ,
    template : `<div class="user-info-body Authentication-house-Add Authentication-station">
                    <div class="user-info-title">新建活动投票</div>
                    <div class="auth-house-new-item">
                        <div class="auth-house-new-name">
                            活动标题
                        </div>
                        <div class="auth-house-new-content">
                            <input type="text" class="auth-input" v-model="title">
                        </div>
                    </div>
                    
                     
                    <div class="auth-house-new-item">
                        <div class="auth-house-new-name">
                            投票截止时间
                        </div>
                        <div class="auth-house-new-content">
                            <input type="text" class="auth-input" id="new_event_time_input" readonly>
                        </div>
                    </div>
					<div class="auth-house-new-item">
					    <div class="auth-house-new-name">
					        发布区域
					    </div>
					    <div class="auth-house-new-content">
					    	<select name="" id="" v-model="type">
					    		<option value="1">家园调查</option>
					    		<option value="2" v-if="info.group_id == 2||info.group_id == 7" >业主管理</option>
							</select>
					    </div>
					</div>
                    
                   <div class="auth-house-new-item align-items-start">
                        <div class="auth-house-new-name">
                            投票事件
                        </div>
                        <div class="auth-house-new-content">
                            <textarea name="" id="" cols="30" rows="10" v-model="event"></textarea>
                        </div>
                    </div>
              
                    <div class="auth-house-submit">
                        <div class="submit-btn" @click="tijiao">提交</div>
                    </div>
                </div>`
});
// 新建评议
Vue.component('newappraise-component' , {
    data     : function(){
        return {
            count  : 0 ,
            list   : [] ,
            child  : [] ,
            siteid : '' ,
            title  : '',
			info         : {},
			type:1
        };
    } ,
    filters  : {
        toChies : function( values ){
            let chin_list = [ '一' , '二' , '三' , '四' , '五' , '六' , '七' , '八' , '九' , '十' ];  //所有的数值对应的汉字
            return chin_list[ values - 1 ];
        }
    } ,
    created(){
        let d = {
            user_id : getCookie('user_id') ,
            token   : getCookie('token')
        };
        d     = transFormData(d);
        axios.post(sysurl + 'user/userSite' , d).then(res => {
            if( res.data.data.length ){
                this.siteid = res.data.data[ 0 ].site_id;
            }else{
                layer.msg('无法获取当前站点信息');
            }
        });
    } ,
    mounted(){
        this.child = [
            {
                title       : '' ,
                votecontent : ''
            }
        ];
        laydate.render({
            elem : '#newappraise_input' , //指定元素
            type : 'datetime'
        });
		var formdata = new FormData();
		formdata.append("user_id" , getCookie('user_id'));
		formdata.append("token" , getCookie('token'));
		axios.post(sysurl + 'user/info' , formdata).then(res => {
		    if( res.data.code === 1 ){
		        this.info = res.data.data;
		        
		    }else{
		        // layer.msg(res.data.msg);
		    }
		} , err => {}).catch(( error ) => {});
    } ,
    methods  : {
        tijiao(){
            let d = new FormData();
            d.append('user_id' , getCookie('user_id'));
            d.append('token' , getCookie('token'));
            d.append('site_id' , this.siteid);
            d.append('title' , this.title);
            d.append('endtime' , $('#newappraise_input').val());
			d.append('type' , this.type);
            // d.append('child',JSON.stringify(this.child));
            // d.append('child[]',JSON.stringify(this.child));
            let newarr = [];
            for( i in this.child ){
                d.append('child[' + i + '][title]' , JSON.stringify(this.child[ i ].title));
                d.append('child[' + i + '][votecontent]' , JSON.stringify(this.child[ i ].votecontent));
            }
            axios.post(sysurl + 'vote/childVoteAdd' , d).then(res => {
                if( res.data.code == 1 ){
                    layer.msg('创建成功');
                    Object.assign(this.$data , this.$options.data());
                    $('#newappraise_input').val('');
                }else{
                    layer.msg(res.data.msg);
                }
            });
        } ,
        add(){
            let n = {
                title       : '' ,
                votecontent : ''
            };
            this.child.push(n);
        }
    }
    ,
    template : `<div class="user-info-body Authentication-house-Add Authentication-station">
                   <div class="user-info-title">新建事件评议</div>
                   <div class="auth-house-new-item">
                       <div class="auth-house-new-name">
                           投票标题
                       </div>
                       <div class="auth-house-new-content">
                           <input type="text" class="auth-input" v-model="title">
                       </div>
                   </div>
                   
                    
                   <div class="auth-house-new-item">
                       <div class="auth-house-new-name">
                           投票截止时间
                       </div>
                       <div class="auth-house-new-content">
                           <input type="text" class="auth-input" readonly id="newappraise_input">
                       </div>
                   </div>
				   <div class="auth-house-new-item">
				       <div class="auth-house-new-name">
				           发布区域
				       </div>
				       <div class="auth-house-new-content">
				       	<select name="" id="" v-model="type">
				       		<option value="1">家园调查</option>
				       		<option value="2" v-if="info.group_id == 2||info.group_id == 7" >业主管理</option>
				   		</select>
				       </div>
				   </div>
                   <div v-for="(item,index) in child">
                       <div class="auth-house-new-item">
                           <div class="auth-house-new-name weight">
                               评议{{ (index+1) | toChies }}
                           </div> 
                           <div class="auth-house-new-content">
                               <input type="text" class="auth-input" v-model="item.title">
                           </div>
                       </div>
                       
                      <div class="auth-house-new-item align-items-start">
                           <div class="auth-house-new-name">
                               评议内容
                           </div>
                           <div class="auth-house-new-content">
                               <textarea name="" id="" cols="30" rows="10" v-model="item.votecontent"></textarea>
                           </div>
                       </div>
                   </div>
              
               
                   <div class="auth-house-submit">
                       <div class="add-btn" @click="add" v-if="child.length<10">增加评议项</div>
                   </div>
                   <div class="auth-house-submit">
                       <div class="submit-btn" @click="tijiao">提交</div>
                   </div>
                </div>`
});
/*其他组件*/
// 首页banner 搜索框 关注站点
Vue.component('homebanner-component' , {
    data     : function(){
        return {
            user_id     : getCookie('user_id') ,
            token       : getCookie('token') ,
            carousel    : [] ,                         // 首页顶部banner
            collectList : {} ,                       // 收藏列表
            search_val  : "" ,                             // 站点输入数据
        };
    } ,
    props    : {} ,
    mounted(){
        this.getBannerList();
        if( this.token ){
            this.getCollectList();
        }
    } ,
    methods  : {
        getBannerList(){
            axios.post(sysurl + 'index/bannerAds' , { category_id : 14 }).then(res => {
                var data = res.data;
                if( data.code === 1 ){
                    this.carousel = data.data;
                }else{
                    layer.msg(res.data.msg);
                }
            } , err => {
            }).catch(( error ) => {
            });
        } ,
        //获取收藏列表
        getCollectList(){
            var data = transFormData({
                user_id : getCookie('user_id') ,
                token   : getCookie('token') ,
                limit   : 1 ,
                page    : 1
            });
            axios.post(sysurl + 'user/collectSiteList' , data).then(res => {
                var datas = res.data;
                if( datas.code === 1 ){
                    if( datas.data.data.length ){
                        this.collectList = datas.data.data[ 0 ];
                        // console.log(datas)
                    }else{
                    }
                }else{
                    // layer.msg(datas.msg);
                }
            } , err => {
            }).catch(( error ) => {
            });
        } ,
        // 搜索站点
        search( type ){
            window.location.href = `./views/home/search.html?keyword=${this.search_val}&type=${type}`;
        } ,
        // 进入当前所在站点
        inNowSite(){
            var data    = this.collectList;

            inSite(data);
            window.localStorage.setItem("station" , JSON.stringify(data));
            if( data.site_level == 5 ){
                window.location.href = "./views/home/stationC.html?siteid=" + data.site_id;
            }else{
                window.location.href = "./views/home/stationB.html?siteid=" + data.site_id;
            }
        }
    } ,
    template : `<div class="carousel-box">
                        <div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
                            <ol class="carousel-indicators">
                                <li v-for="(item,index) in carousel" :key="index" data-target="#carouselExampleIndicators" :data-slide-to="index" :class="{'active':index == 0}"></li>
                            </ol>
                            <div class="carousel-inner">
                                <div v-for="(item,index) in carousel" :key="index" class="carousel-item" :class="{ 'active' :index == 0 }">
                                    <a :href="item.url" target="view_window">
                                        <img class="d-block w-100" :src="item.image_text" alt="First slide">
                                    </a>
                                </div>
                            </div>
                        </div>
                        <div class="box-inner">
                            <div class="large-more">城乡阳光管理监督服务平台</div>
                            <div class="large">社区、小区、院、村、组、农场、合作社、会，网站查询</div>
                            <div class="search-box">
                                <div class="search-input">
                                    <img src="static/icons/搜索(1).png" alt="">
                                    <input type="text" placeholder="请输入基层网站名称、如：xx社区/小区/院/村/组/农场/合作社/会" v-model="search_val">
                                </div>
                                <div class="search-btn" @click="search('site')">搜索站点</div>
                                <div class="search-btn" @click="search('article')">搜索文章</div>
                            </div>
                            <div class="link-row" v-if='collectList.sitename'>我关注的：{{collectList.sitename}}&nbsp;&nbsp;<a @click="inNowSite">(点击进入)</a></div>
                        </div>
                    </div>`
});
// 分站顶部链接
Vue.component('navlink-component' , {
    data     : function(){
        return {
            bannerList : ""           // 投诉列表
        };
    } ,
    props    : {
        siteid : {
            default(){
                return {};
            }
        }
    } ,
    mounted(){
        this.getBannerList();
    } ,
    methods  : {
        getBannerList(){
            axios.post(sysurl + 'index/bannerAds' , { category_id : 45 , site_id : this.siteid.site_id || 0 }).then(res => {
                var data = res.data;
                if( data.code === 1 ){
                    this.bannerList = data.data;
                }else{
                    layer.msg(res.data.msg);
                }
            } , err => {
            }).catch(( error ) => {
            });
        }
    } ,
    template : `<div class="adv-img-box" v-if="bannerList.length">
                        <div class="adv-img">
                            <a v-for="(item,index) in bannerList" :href="item.url">
                                <img v-if="item.image_text" :src="item.image_text">
                                <span v-if="item.image_text==''||item.image_text==null">{{item.name}}</span>
                            </a>
                        </div>
                    </div>`
});
// 分站顶部链接
Vue.component('navlink2-component' , {
    data     : function(){
        return {
            bannerList : ""           // 投诉列表
        };
    } ,
    props    : {
        siteid : {
            default(){
                return {};
            }
        }
    } ,
    mounted(){
        this.getBannerList();
    } ,
    methods  : {
        getBannerList(){
            axios.post(sysurl + 'index/bannerAds' , { category_id : 44 , site_id : this.siteid.site_id || 0 }).then(res => {
                var data = res.data;
                if( data.code === 1 ){
                    this.bannerList = data.data;
                }else{
                    layer.msg(res.data.msg);
                }
            } , err => {
            }).catch(( error ) => {
            });
        }
    } ,
    template : `<div class="adv-row">
                    <a :href="item.url" v-for="(item,index) in bannerList" ><img :src="item.image_text"></a>
                </div>`
});

// 内页主站导航 首页
Vue.component('navrow-component' , {
    data     : function(){
        return {
            columnData:"",
            navlist:[]
        };
    } ,
    props    : {
        siteid : {
            default(){
                return {};
            }
        }
    } ,
    mounted(){
        this.getColumnData();
        var formdata = new FormData()
        formdata.append("pid",0)
        formdata.append("type",1)

        axios.post(sysurl + 'index/nav' , formdata).then(res => {

            if( res.data.code == 1 ){
                this.navlist = res.data.data;
            }else{
                if(res.data.data != 0){
                    layer.msg(res.data.msg);
                }
            }
        } , err => {}).catch(( error ) => {});
    } ,
    methods  : {
        loginout : function(){
            this.$emit('loginout');
        } ,
        getColumnData(){
            axios.post(sysurl + 'index/special' , { site_id : this.siteid.site_id || 0}).then(res => {
                var datas = res.data;
                if( datas.code == 1 ){
                    this.columnData = datas.data;
                }else{
                    if(res.data.data != 0){
                        // layer.msg(res.data.msg);
                    }
                }
            } , err => {}).catch(( error ) => {});
        },



    } ,
    template : `<div class="nav-row">
                    <ul>
                        <li><a href="../../index.html">首页</a></li>
                        <li v-for="(l,index) in navlist"><a :href="'../../views/about/public.html?id='+l.id+'&station_type=1&banner_type='+l.banner_type">{{l.name}}</a></li>
<!--                        <li><a href="../../views/about/about.html">关于我们</a></li>-->
<!--						<li><a href="../../views/news/news.html?tag=jiayuan&bannerid=133">家园见闻</a></li>-->
<!--						<li><a href="../../views/news/news.html?tag=fazhi&bannerid=134">法制道德</a></li>-->
<!--						<li><a href="../../views/news/news.html?tag=gongyi&bannerid=135">公益帮助</a></li>-->
<!--                        <li><a href="../../views/investigation/investigation.html">家园调查</a></li>-->
<!--                        <li><a href="../../views/problem/problem.html">卜咚问问</a></li>-->
<!--                         <li v-if="columnData.id"><a :href="'../../views/column/column.html?type=home&category_id=' + columnData.id + '&category_name=' + columnData.name + '&icon=' + columnData.image">{{columnData.name}}</a></li>-->
                    </ul>
                </div>`
});
// 分站顶部导航 行政站点
Vue.component('navtab2-component' , {
    data     : function(){
        return {
            columnData : "",
            list : [
                { id : 73  , txt : '服务公告' },
                { id : 74  , txt : '政府信息' },
                { id : 111  , txt : '便民服务' },
                // { id : 112  , txt : '家园服务' },
            ],
            navlist:[]
        };
    } ,
    props    : {
        siteid : {
            default(){
                return {};
            }
        }
    } ,
    mounted(){
        this.getColumnData();

        var formdata = new FormData()
        formdata.append("pid",0)
        formdata.append("type",2)

        axios.post(sysurl + 'index/nav' , formdata).then(res => {

            if( res.data.code == 1 ){
                this.navlist = res.data.data;
            }else{
                if(res.data.data != 0){
                    layer.msg(res.data.msg);
                }
            }
        } , err => {}).catch(( error ) => {});
    } ,
    methods  : {
        getColumnData(){
            axios.post(sysurl + 'index/special' , { site_id : this.siteid.site_id || 0}).then(res => {
                var datas = res.data;
                if( datas.code == 1 ){
                    this.columnData = datas.data;
                }else{
                    if(res.data.data != 0){
                        // layer.msg(res.data.msg);
                    }
                }
            } , err => {}).catch(( error ) => {});
        }
    } ,
    template : `<div class="nav-row">
                    <ul>
                        <li><a :href="'../../views/home/stationB.html?siteid=' + siteid.site_id">首页</a></li>
                        <li v-for="item in navlist"><a :href="'../../views/about/public.html?id='+item.id+'&station_type=2&banner_type='+item.banner_type">{{ item.name }}</a></li>
<!--                        <li v-for="item in list"><a :href="'../../views/site/sitelist.html?id='+item.id+'&name='+item.txt">{{ item.txt }}</a></li>-->
<!--                        <li><a href="../../views/news/news.html?tag=paotui&bannerid=151">跑腿服务</a></li>-->
<!--                        <li><a href="../../views/site/sitelist.html?id=112&name=家园服务">家园服务</a></li>-->
<!--                        <li><a href="../../views/news/news.html?tag=jiayuan&bannerid=133">家园见闻</a></li>-->
<!--                        <li><a href="../../views/news/news.html?tag=fazhi&bannerid=134">法制道德</a></li>-->
<!--                        <li><a href="../../views/news/news.html?tag=gongyi&bannerid=135">公益帮助</a></li>-->
<!--                        <li><a href="../../views/investigation/investigation.html">家园调查</a></li>-->
<!--                        <li><a href="../../views/problem/problem.html">卜咚问问</a></li>-->
<!--                         <li v-if="columnData.id"><a :href="'../../views/column/column.html?category_id=' + columnData.id + '&category_name=' + columnData.name + '&icon=' + columnData.image" v-if="columnData.id" >{{columnData.name}}</a></li>-->
                    </ul>
                </div>`
});
// 分站顶部导航 基层站点
Vue.component('navtab3-component' , {
    data     : function(){
        return {
            columnData:"",
            list : [
                { id : 113 , txt : '我的家园' } ,
                { id : 47  , txt : '政府管理' } ,
                { id : 48  , txt : '业主管理' } ,
                { id : 49  , txt : '委会工作' } ,
                { id : 50  , txt : '服务管理' } ,
                { id : 51  , txt : '基层党建' },
                { id : 111 , txt : '便民服务' } ,
                // { id : 112 , txt : '家园服务中心' } ,
            ],
            navlist:[]
        };
    } ,
    props    : {
        siteid : {
            default(){
                return {};
            }
        }
    } ,
    mounted(){
        this.getColumnData();


        var formdata = new FormData()
        formdata.append("pid",0)
        formdata.append("type",3)

        axios.post(sysurl + 'index/nav' , formdata).then(res => {

            if( res.data.code == 1 ){
                this.navlist = res.data.data;
            }else{
                if(res.data.data != 0){
                    layer.msg(res.data.msg);
                }
            }
        } , err => {}).catch(( error ) => {});
    } ,
    methods  : {
        getColumnData(){
            axios.post(sysurl + 'index/special' , { site_id : this.siteid.site_id || 0}).then(res => {
                var datas = res.data;
                if( datas.code == 1 ){
                    this.columnData = datas.data;
                }else{
                    if(res.data.data != 0){
                        // layer.msg(res.data.msg);
                    }
                }
            } , err => {}).catch(( error ) => {});
        }


    } ,
    template : `<div class="nav-row">
                    <ul>
                        <li><a :href="'../../views/home/stationC.html?siteid=' + siteid.site_id">首页</a></li>
                        <li v-for="item in navlist"><a :href="'../../views/about/public.html?id='+item.id+'&station_type=3&banner_type='+item.banner_type">{{ item.name }}</a></li>
<!--                        <li v-for="item in list"><a :href="'../../views/site/sitelist.html?id='+item.id+'&name='+item.txt">{{ item.txt }}</a></li>-->
<!--                        <li><a href="../../views/news/news.html?tag=paotui&bannerid=151">跑腿办事</a></li>-->
<!--                        <li><a href="../../views/site/sitelist.html?id=115&name=家园服务中心">家园服务中心</a></li>-->
<!--                        <li><a href="../../views/news/news.html?tag=jiayuan&bannerid=133">家园见闻</a></li>-->
<!--                        <li><a href="../../views/news/news.html?tag=fazhi&bannerid=134">法制道德</a></li>-->
<!--                        <li><a href="../../views/news/news.html?tag=gongyi&bannerid=135">公益帮助</a></li>-->
<!--                        <li><a href="../../views/investigation/investigation.html">家园调查</a></li>-->
<!--                        <li><a href="../../views/problem/problem.html">卜咚问问</a></li>-->
<!--                       <li v-if="columnData.id"><a :href="'../../views/column/column.html?category_id=' + columnData.id + '&category_name=' + columnData.name + '&icon=' + columnData.image">{{columnData.name}}</a></li>-->
                    </ul>
                </div>`
});
// nav
Vue.component('nav-component' , {
    data     : function(){
        return {
            columnData : "",
            siteNumber:0,
            navlist:[],
			site:'',
			siteInfo:{}
        };
    } ,
    props:{
        siteid : {
            type : Object ,
            default(){
                return {};
            }
        } ,
    },
    mounted(){
        var site = JSON.parse(window.localStorage.getItem("station")) || {};
		  this.site = JSON.parse(localStorage.getItem('station')) || {};
        var f = new FormData()
        f.append('site_id',site.site_id||0)
        axios.post(sysurl + 'user/siteInfo' , f).then(res => {
            this.siteNumber = res.data.data.site_number;
			this.siteInfo = res.data.data
        } , err => {}).catch(( error ) => {});



        this.getColumnData();


        var formdata = new FormData()
        formdata.append("pid",0)
        formdata.append("type",1)

        axios.post(sysurl + 'index/nav' , formdata).then(res => {

            if( res.data.code == 1 ){
                this.navlist = res.data.data;
            }else{
                if(res.data.data != 0){
                    layer.msg(res.data.msg);
                }
            }
        } , err => {}).catch(( error ) => {});
    } ,
    methods  : {
        getColumnData(){
            axios.post(sysurl + 'index/special' , { site_id : this.siteid.site_id || 0}).then(res => {
                var datas = res.data;
                if( datas.code == 1 ){
                    this.columnData = datas.data;
                }else{
                    if(res.data.data != 0){
                        // layer.msg(res.data.msg);
                    }
                }
            } , err => {}).catch(( error ) => {});
        }
    } ,
    template : `<nav style="height:7rem;display:flex;align-items: center;margin-top: 0;">
                    <div class="nav-top">
                        <div class="nav-le">
                            <a href="./index.html" class="logo-box">
								<img src="static/images/logo.png" style="width: 2.88rem;">
								<div class="name-box">
									<p class="jy-title">{{ site.site_id ? decodeURI(site.sitename)+siteInfo.sitename : siteInfo.sitename }}</p>
									<p class="jy-website">城乡阳光管理监督服务平台</p>
								</div>
								</a>
                            <div class="site_number">
                                <span>本站家园编号：</span>
                                <span class="orange">{{siteNumber}}</span>
                            </div>
                        </div>
                        <div class="nav-ri">
                            <ul>
                                <li class="active"><a href="">首页</a></li>
<!--                                <li><a href="./views/about/about.html">关于我们</a></li>-->
<!--                                <li><a href="./views/news/news.html?tag=jiayuan&bannerid=133">家园见闻</a></li>-->
<!--                                <li><a href="./views/news/news.html?tag=fazhi&bannerid=134">法制道德</a></li>-->
<!--                                <li><a href="./views/news/news.html?tag=gongyi&bannerid=135">公益帮助</a></li>-->
<!--                                <li><a href="./views/investigation/investigation.html">家园调查</a></li>-->
<!--                                <li><a href="./views/problem/problem.html">卜咚问问</a></li>-->
									<li v-for="(l,index) in navlist"><a :href="'./views/about/public.html?id='+l.id+'&station_type=1&banner_type='+l.banner_type">{{l.name}}</a></li>
 <!--                               <li v-if="columnData.id"><a :href="'./views/column/column.html?type=home&category_id=' + columnData.id + '&category_name=' + columnData.name + '&icon=' + columnData.image" v-if="columnData.id">{{columnData.name}}</a></li>-->
                            </ul>
                        </div>
                    </div>
                </nav>`
});
// 二级页面banner
Vue.component('subpagebanner-component' , {
    data     : function(){
        return {
            bannerData : "",
        };
    } ,
    props:{
        siteid : {
            type : Object ,
            default(){
                return {};
            }
        } ,
        // 分类id（ 132 : 关于我们,133 : 家园见闻,134 : 法制道德,135 : 公益帮助,136 : 家园调查,137 : 卜咚问问,138 : 专题栏目）
        bannerid:{}
    },
    mounted(){
        this.getBanner();
    } ,
    methods  : {
        // 获取二级页面banner
        getBanner(){
            var data = transFormData({
                site_id : this.siteid.site_id || 0,
                banner_category:this.bannerid
            })
            axios.post(sysurl + 'index/articleCategoryBanner' , data).then(res => {
                var datas = res.data;
                if( datas.code == 1 ){
                    this.bannerData = datas.data;
                }else{
                    if(res.data.data != 0){
                        layer.msg(res.data.msg);
                    }
                }
            } , err => {}).catch(( error ) => {});
        }
    } ,
    template : `<div class="carousel-box" v-if="bannerData.length">
                    <div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
                        <ol class="carousel-indicators">
                            <li data-target="#carouselExampleIndicators" v-for="(item,index) in bannerData" :data-slide-to="index" :class="{'active' : index == 0}"></li>
                        </ol>
                        <div class="carousel-inner">
                            <div class="carousel-item" v-for="(item,index) in bannerData" :class="{'active' : index == 0}">
                                <a :href="item.url" :target="item.targetdata == 1 ? '_self' : '_blank'" style="display:block">
                                    <img class="d-block w-100" :src="item.image_text" :alt="item.name">
                                </a>
                            </div>
                        </div>
                    </div>
                </div>`
});


// 分站搜索框
Vue.component('navsearch-component' , {
    data     : function(){
        return {
            keyword : "",              // 搜索关键字
            siteNumber:0,
			site:'',
			siteInfo:''
        };
    } ,
    mounted(){
        var site = JSON.parse(window.localStorage.getItem("station")) || {};
        this.site = JSON.parse(window.localStorage.getItem("station")) || {};
        // this.siteNumber = site.site_number || 0;

        var f = new FormData()
        f.append('site_id',site.site_id||0)
        axios.post(sysurl + 'user/siteInfo' , f).then(res => {
            this.siteNumber = res.data.data.site_number;
			this.siteInfo = res.data.data
        } , err => {}).catch(( error ) => {});
    } ,
    methods  : {} ,
    template : `<nav>
                    <div class="nav-top">
                        <div class="nav-le">
                           
							
							
							<a href="../../index.html" class="logo-box">
								<img src="../../static/images/logo.png" style="width: 2.88rem;">
								<div class="name-box">
									<p class="jy-title">{{ site.site_id ? siteInfo.sitename : siteInfo.sitename }}</p>
									<p class="jy-website">城乡阳光管理监督服务平台</p>
								</div>
								</a>
                            <div class="site_number">
                                <span>本站家园编号：</span>
                                <span class="orange">{{siteNumber}}</span>
                            </div>
                        </div>
                        <div class="nav-ri">
                            <div class="search-box">
                                <div class="search-input">
                                    <img src="../../static/icons/搜索(1).png" alt="">
                                    <input type="text" placeholder="请输入基层网站名称、如：xx社区/小区/院/村/组/农场/合作社/会" v-model="keyword">
                                    <div class="input-position">
                                        <a>热门搜索：</a>
                                        <a>蓝湖橘郡</a>
                                        <a>尚品C经</a>
                                        <a>英郡icon</a>
                                    </div>
                                </div>
                                <a class="search-btn" :href="'./../home/search.html?keyword=' + keyword + '&type=site'">搜索站点</a>
                                <a class="search-btn" :href="'./../home/search.html?keyword=' + keyword + '&type=article'">搜索文章</a>
                            </div>
                        </div>
                    </div>
                </nav>`
});
// 投诉列表
Vue.component('report-component' , {
    data     : function(){
        return {
            reportList : ""           // 投诉列表
        };
    } ,
    props    : {
        siteid : {
            default(){
                return {};
            }
        }
    } ,
    mounted(){
        this.getReportList();
    } ,
    methods  : {
        getReportList(){
            axios.post(sysurl + 'index/tipOffWay' , { site_id : localStorage.getItem("siteInfo").site_id || 0 }).then(res => {
                var data = res.data;
                if( data.code === 1 ){
                    this.reportList = data.data;
                }else{
                    layer.msg(res.data.msg);
                }
            } , err => {
            }).catch(( error ) => {
            });
        }
    } ,
    template : `<div class="report" v-if="reportList.length">
                    <div class="complaint">
                        <a class="complaint-item" v-for="(item,index) in reportList" target="_blank" :href="item.url">{{item.name}}</a>
                    </div>
                </div>`
});
// 友情链接
Vue.component('blogroll-component' , {
    data     : function(){
        return {
            blogrollList : "" ,          // 投诉列表
			siteInfo:''
        };
    } ,
    props    : {} ,
    mounted(){
		
		this.$nextTick(function () {
		        this.siteInfo = JSON.parse(window.localStorage.getItem("siteInfo"))
		        this.getBlogrollList();
		      })
        
    } ,
    methods  : {
        getBlogrollList(){
            axios.post(sysurl + 'index/friendsLink' , {site_id:this.siteInfo.site_id}).then(res => {
                var data = res.data;
                if( data.code === 1 ){
                    this.blogrollList = data.data;
                }else{
                    layer.msg(res.data.msg);
                }
            } , err => {
            }).catch(( error ) => {
            });
        }
    } ,
    template : `<div class="friend-link">
                        <div class="link-title">
                            <a href="">友情链接</a>
                        </div>
                        <div class="adv-box">
                            <a class="adv-item" :data-id="item.id" v-for="(item,index) in list" :href="item.url" :title="item.name">
                            	<span v-if="item.image==null" >{{item.name}}</span>	
                                <img v-if="item.image" :src="item.image" :alt="item.name" height="38">
                            </a>
                        </div>
                    </div>`
});
/*投诉*/
/* 配置路径*********************/
// 家园见闻 TODO 需要
Vue.component('knowledge-component' , {
    data(){
        return {
            myTabList     : "" ,
            articleList   : "" ,
            siteinfo   :  '',
            nowItem : ""             // 当前分类id
        };
    } ,
    props    : {
        url    : {
            type    : String ,
            default : "./"
        } ,
        siteid : {
            default(){
                return {};
            }
        }
    } ,
    mounted(){
        this.getTabList();
		this.siteinfo = JSON.parse(localStorage.getItem('siteInfo'))
		// console.log(this.siteinfo)
    } ,
    methods  : {
        // 获取tab list
        getTabList(){
            axios.post(sysurl + 'index/articleCategory' , { type : 25 ,site_id : this.siteid.site_id || 0 }).then(res => {
                var data = res.data;
                if( data.code === 1 ){
                    this.myTabList     = data.data;
                    this.nowItem = data.data[0];
                    this.getArticleList(data.data[0]);
                }else{
                    layer.msg(res.data.msg);
                }
            } , err => {}).catch(( error ) => {});
        } ,
        // 获取文章列表
        getArticleList( item ){        // type ：文章列表分类   id ：分类id
            this.nowItem = item;
            axios.post(sysurl + 'index/articleList' , {
                category_id : item.category_id ,
                limit       : 10 ,
                site_id     : this.siteid.site_id || 0
            }).then(res => {
                var data = res.data;
                if( data.code === 1 ){
                    this.articleList = data.data.data;
                }else{
                    layer.msg(res.data.msg);
                }
            } , err => {}).catch(( error ) => {});
        }
    } ,
    template : `<div class="experience-box">
                  <div class="experience-title">
                      <div class="experience-title-text">家园监督</div>
                  </div>
                  <div class="experience-container">
                      <ul class="nav nav-tabs" id="myTab" role="tablist">
                          <li class="nav-item" v-for="(item,index) in myTabList" @click="getArticleList(item)">
                              <a class="nav-link" :class="{'active' : index == 0}" :id="'tab' + item.category_id"
                                 data-toggle="tab" role="tab" aria-controls="hotspot" :aria-selected="index == 0">
                                  {{item.name}}
                              </a>
                          </li>
                      </ul>
                      <div class="tab-content" id="myTabContent">
                          <div class="tab-pane fade show active">
                              <a class="experience-list" v-for="(item,index) in articleList" :key="index" v-if="nowItem.category_id" 
                                :href="url + 'views/about/public.html?id=9&station_type='+(siteinfo.site_level+1)+'&banner_type=133#/detail?&articleid=' + item.id + '&id=' + nowItem.category_id + '&category_name=' + nowItem.name">
                                  <div class="experience-list-title">{{item.title}}</div>
                                  <!-- <div class="experience-list-content">
                                      <img :src="v" v-for="(v,i) in item.coverimages_text" :key="'img' + i">
                                  </div> -->
                              </a>
                          </div>
                      </div>
                  </div>
              </div>`
});
// 法制道德 TODO 需要
Vue.component('legalsystem-component' , {
    data(){
        return {
            myTabList     : "" ,
            articleList   : "" ,
			siteinfo   :  '',
            nowItem       : ""             // 当前分类id
        };
    } ,
    props    : {
        url    : {
            type    : String ,
            default : "./"
        } ,
        siteid : {
            default(){
                return {};
            }
        }
    } ,
    mounted(){
		this.siteinfo = JSON.parse(localStorage.getItem('siteInfo'))
        this.getTabList();
    } ,
    methods  : {
        // 获取tab list
        getTabList(){
            axios.post(sysurl + 'index/articleCategory' , { type : 30 , site_id : this.siteid.site_id || 0 }).then(res => {
                var data = res.data;
                if( data.code === 1 ){
                    this.myTabList     = data.data;
                    this.nowItem = data.data[0];
                    this.getArticleList(data.data[0]);
                }else{
                    layer.msg(res.data.msg);
                }
            } , err => {}).catch(( error ) => {});
        } ,
        // 获取文章列表
        getArticleList( item ){        // type ：文章列表分类   id ：分类id
            this.nowItem = item;
            axios.post(sysurl + 'index/articleList' , {
                category_id : item.category_id ,
                limit       : 10 ,
                site_id     : this.siteid.site_id || 0
            }).then(res => {
                var data = res.data;
                if( data.code === 1 ){
                    this.articleList = data.data.data;
                }else{
                    layer.msg(res.data.msg);
                }
            } , err => {}).catch(( error ) => {});
        }
    } ,
    template : `<div class="governed-law-box">
                        <div class="governed-law-header">
                            <div class="governed-law-header-title">家园法治</div>
                            <div class="governed-law-header-nav">
                                <ul class="nav nav-tabs" id="myTab2" role="tablist">
                                    <li class="nav-item" v-for="(item,index) in myTabList" @click="getArticleList(item)">
                                        <a class="nav-link" :class="{'active' : index == 0}"
                                           :id="'tab' + item.category_id" data-toggle="tab" role="tab"
                                           aria-controls="hotspot" :aria-selected="index == 0">
                                            {{item.name}}
                                            <!--<img class="tip" src="static/icons/多边形686.png" alt="">-->
                                        </a>
                                    </li>
                                </ul>
                            </div>
                        </div>
                        <a class="governed-law-list" v-for="(item,index) in articleList" :key="index"
                           :href="url + 'views/about/public.html?id=23&station_type='+(siteinfo.site_level+1)+'&banner_type=134#/detail?&articleid=' + item.id + '&id=' + nowItem.category_id + '&category_name=' + nowItem.name">
                            <!-- <div class="governed-law-list-img" :style="{'background-image': 'url('+ item.coverimages_text[0] +')'}"></div> -->
                            <div class="governed-law-list-content">
                                <div class="list-title" v-text="item.title"></div>
                                <!-- <div class="list-text">{{item.postcontent | textFilter}}</div> -->
                              
                            </div>
                        </a>
                    </div>`,
    filters:{
        // 过滤中文
        textFilter(txt){
            var str;
            str = txt.match(regHtml,"");
            return str.join("");
        }
    },

});
// 公益帮助 TODO 需要
Vue.component('publicinterest-component' , {
    data(){
        return {
            myTabList     : "" ,
            articleList   : "" ,
            nowItem       : "" ,            // 当前分类id
            html          : "",
        };
    } ,
    props    : {
        url    : {
            type    : String ,
            default : "./"
        } ,
        siteid : {
            default(){
                return {};
            }
        }
    } ,
    mounted(){
        this.getTabList();
    } ,
    methods  : {
        // 获取tab list
        getTabList(){
            axios.post(sysurl + 'index/articleCategory' , { type : 36 , site_id : this.siteid.site_id || 0 }).then(res => {
                var data = res.data;
                if( data.code === 1 ){
                    this.myTabList     = data.data;
                    this.nowItem = data.data[0];
                    this.getArticleList(data.data[0]);
                }else{
                    layer.msg(res.data.msg);
                }
            } , err => {}).catch(( error ) => {});
        } ,
        // 获取文章列表
        getArticleList( item ){        // type ：文章列表分类   id ：分类id
            this.nowItem = item;
			// console.log(item,'id');
			axios.post(sysurl + 'index/articleList' , {
                category_id : item.category_id ,
                limit       : 10 ,
                site_id     : this.siteid.site_id || 0
            }).then(res => {
                var data = res.data;
                if( data.code === 1 ){
                    this.articleList = data.data.data;
                }else{
                    layer.msg(res.data.msg);
                }
            } , err => {}).catch(( error ) => {});
        }
    } ,
    filters:{
        // 过滤中文
        textFilter(txt){
            var str;
            str = txt.match(regHtml,"");
            return str.join("");
        }
    },
    template : `<div class="help">
                        <div class="experience-title">
                            <div class="experience-title-text">家园帮助</div>
                        </div>
                        <div class="experience-container">
                            <ul class="nav nav-tabs" id="myTab3" role="tablist">
                                <li class="nav-item" v-for="(item,index) in myTabList" :key="'myTab3' + index" @click="getArticleList(item)">
                                    <a class="nav-link" :class="{'active' : index == 0}" :id="'tab' + item.category_id"
                                       data-toggle="tab" role="tab" aria-controls="public" :aria-selected="index == 0">
                                        {{item.name}}
                                        <!--<img class="tip" src="static/icons/多边形686.png" alt="">-->
                                    </a>
                                </li>
                            </ul>
                            <div class="tab-content" id="myTabContent3">
                                <a class="tab-pane fade show active" v-for="(item,index) in articleList"
                                   :href="url + 'views/news/news.html#/detail?tag=gongyi&articleid=' + item.id + '&id=' + nowItem.category_id + '&category_name=' + nowItem.name + '&bannerid=135'">
                                    <div class="help-list" v-if="index == 0">
                                       
<!--                                        <div class="help-list-text" id="help-list-text" style="display:none" v-html="item.postcontent"></div>
                                        <div class="help-list-text">{{item.postcontent | textFilter}}</div>-->
                                    </div>
                                    <div class="item-list line-clamp-2">{{item.title}}</div>
                                </a>
                            </div>
                        </div>
                    </div>`
});
// 新闻列表 TODO 需要
Vue.component('news-component' , {
    data(){
        return {
            articleList : ""               ,// 调查数据列表
			columnData:'',
			siteinfo:{},
			sitelevel:'',
			did:''
			
        };
    } ,
    props    : {
        siteid : {
            default(){
                return {};
            }
        } ,
        url    : {
            type    : String ,
            default : "./"
        }
    } ,
    mounted(){
		this.siteinfo = JSON.parse(localStorage.getItem("siteInfo"))
		this.sitelevel = this.siteinfo.site_level<3?this.siteinfo.site_level+1:3
		if(this.sitelevel == 1){
			this.did = 232
		}else if(this.sitelevel == 2){
			this.did = 234
		}else{
			this.did = 237
		}
        this.getArticleList();
		
    } ,
    methods  : {
        // 获取文章列表
		
		// getColumnData(){
		// 	let that = this
		//     axios.post(sysurl + 'index/topicList' , { site_id : this.siteid.site_id || 0}).then(res => {
		//         var datas = res.data;
		//         if( datas.code == 1 ){
		//             this.columnData = datas.data;
					
		// 			this.getArticleList(datas.data.id)
				
					
					
		//         }else{
		//             if(res.data.data != 0){
		//                 // layer.msg(res.data.msg);
		//             }
		//         }
		//     } , err => {}).catch(( error ) => {});
		// },
        getArticleList(){
			var forms = new FormData()
			forms.append("site_id",this.siteid.site_id || 0)
			forms.append("limit",15)
			forms.append("page",1)
            axios.post(sysurl + 'index/topicList' ,forms).then(res => {
                var data = res.data;
                if( data.code === 1 ){
                    this.articleList = data.data.data;
                }else{
                    layer.msg(res.data.msg);
                }
            } , err => {
            }).catch(( error ) => {
            });
        }
    } ,
    template : `<div class="news" v-if="articleList.length">
					<div id="carouselExampleIndicators2" class="carousel slide" data-ride="carousel">
						<div class="carousel-inner">
							<a class="carousel-item"
								:href="url+'views/about/public.html?id='+did+'&station_type='+sitelevel+'&banner_type=138'" 
								:class="{ 'active' : index == 0 }" v-for="(item,index) in articleList" v-if="index < 3">
								<img class="d-block w-100" :src="item.coverimages_text[0]" :alt="item.title">
								<div class="carousel-caption d-none d-md-block">
									<h5>{{item.title}}</h5>
								</div>
							</a>
						</div>
						<a class="carousel-control-prev" href="#carouselExampleIndicators2" role="button" data-slide="prev">
							<span class="carousel-control-prev-icon" aria-hidden="true"></span>
							<span class="sr-only">Previous</span>
						</a>
						<a class="carousel-control-next" href="#carouselExampleIndicators2" role="button" data-slide="next">
							<span class="carousel-control-next-icon" aria-hidden="true"></span>
							<span class="sr-only">Next</span>
						</a>
					</div>
					
					<div class="news-item" v-if="articleList.length > 3">
						<a v-for="(item,index) in articleList" v-if="index >= 3"
							:href="url+'views/about/public.html?id='+did+'&station_type='+sitelevel+'&banner_type=138'">
							<span></span>
							<span>{{item.title}}</span>
						</a>
					</div>
				</div>`
});
/* 配置路径********************/

/* 配置站点 **********************************/
// 区域站点导航列表
Vue.component('classifysite-component' , {
    data     : function(){
        return {
            serveCenterList : "" ,         // 生活服务数据列表
            centerList      : ""               // 中间服务数据
        };
    } ,
    props    : {
        siteid : {
            default(){
                return {};
            }
        }
    } ,
    mounted(){
        this.getCenterServeList();
        this.getCenterData();
    } ,
    methods  : {
        // 获取家园服务中心
        getCenterServeList(){
            axios.post(sysurl + 'index/siteNavigation' , {
                type    : 63 ,
                site_id : this.siteid.site_id || 0
            }).then(res => {
                var data = res.data;
                if( data.code == 1 ){
                    this.serveCenterList = data.data;
                }else{
                    layer.msg(res.data.msg);
                }
            } , err => {
            }).catch(( error ) => {
            });
        } ,
        // 获取中间服务连接
        getCenterData(){
            axios.post(sysurl + 'index/siteNavigation' , {
                type    : 65 ,
                site_id : this.siteid.site_id || 0
            }).then(res => {
                var data = res.data;
                if( data.code == 1 ){
                    this.centerList = data.data;
                }else{
                    layer.msg(res.data.msg);
                }
            } , err => {
            }).catch(( error ) => {
            });
        }
    } ,
    template : `<div class="classify-box">
                   <div class="classify-top">
                       <div class="classify-item" v-for="(item,index) in centerList" v-if="centerList.length && index < 3">
                           <a>【{{item.name}}】</a>
                           <a :href="v.url" v-for="(v,i) in item.child">

                               <img v-if="v.iconimage_text" class="icon-img" :src="v.iconimage_text">
                               <span>{{v.name}}</span>
                           </a>
                       </div>
                   </div>
                   <div class="classify-bottom">
                       <div class="classify-bottom-l">
                           <span>家</span>
                           <span>园</span>
                           <span>购</span>
                           <span>物</span>
                           <span>中</span>
                           <span>心</span>
                       </div>
                       
					   
					   <div class="classify-bottom-r">
					       <div class="classify-item" v-for="(item,index) in serveCenterList" v-if="serveCenterList.length && index < 4">
					           <a>【{{item.name}}】</a>
					           <a :href="v.url" v-for="(v,i) in item.child">
					   
					               <img v-if="v.iconimage_text" class="icon-img" :src="v.iconimage_text">
					               <span>{{v.name}}</span>
					           </a>
					       </div>
					   </div>
                   </div>
               </div>`
});
// 任务列表
Vue.component('tasklist-component' , {
    data(){
        return {
            id       : "" ,
            taskType : 1 ,
            siteinfo : '' ,
            sitelevel : '' ,
            taskList : ""
        };
    } ,
    props    : {
        siteid : {
            default(){
                return {};
            }
        },
		url    : {
		    type    : String ,
		    default : "../../"
		}
    } ,
    mounted(){
		this.siteinfo = JSON.parse(localStorage.getItem('siteInfo'))
		this.sitelevel = 2
        this.toggleTaskList();
    } ,
    methods  : {
        // 基层站 ： category_id :  1: 跑腿服务  2：任务发布  3：任务大厅
        toggleTaskList( type ){
            this.taskType   = type || this.taskType;
            var category_id = this.taskType == 1 ? 54 : this.taskType == 2 ? 55 : this.taskType == 3 ? 56 : "";
			if(type==2){
				window.location.href = "../about/public.html?id=57&station_type="+this.sitelevel+"&banner_type=151#/18?id=58"
			}
			if(type==3){
				window.location.href = "../about/public.html?id=57&station_type="+this.sitelevel+"&banner_type=151#/19?id=59"
			}
            axios.post(sysurl + 'asking/task' , {
                site_id     : this.siteid.site_id || 0 ,
                category_id : category_id ,
                limit       : 4 ,
                page        : 1
            }).then(res => {
                var data = res.data;
                if( data.code == 1 ){
                    this.taskList = data.data.data;
                }else{
                    layer.msg(res.data.msg);
                }
            } , err => {
            }).catch(( error ) => {
            });
        }
    } ,
    template : `<div class="task-box">
                   <div class="task-img-box">
                       <div class="errands task-img" :class="{'active' : taskType == 1 }" @click="toggleTaskList(1)">
                           <span>跑</span>
                           <span>腿</span>
                           <span>办</span>
                           <span>事</span>
                       </div>
                       <div class="errands task-img" :class="{'active' : taskType == 2 }" @click="toggleTaskList(2)">
                           <span>任</span>
                           <span>务</span>
                           <span>发</span>
                           <span>布</span>
                       </div>
                       <div class="errands task-img" :class="{'active' : taskType == 3 }" @click="toggleTaskList(3)">
                           <span>任</span>
                           <span>务</span>
                           <span>大</span>
                           <span>厅</span>
                       </div>
                   </div>
                   <div class="task-list">
                       <div class="task-item" v-for="(item,index) in taskList" v-if="taskList.length">
                           
                           <div class="task-item-text"><a :href="url+'views/about/public.html?id=57&station_type=2&banner_type=151#/19?id=59'">{{item.title}}</a></div>
                       </div>
                   </div>
               </div>`
});
// 生活服务
Vue.component('liveserve-component' , {
    data(){
        return {
            taskType  : 1 ,
            serveList : ""
        };
    } ,
    props    : {
        siteid : {
            default(){
                return {};
            }
        }
    } ,
    mounted(){
        this.getServeList();
    } ,
    methods  : {
        // 获取生活服务
        getServeList(){
            axios.post(sysurl + 'index/siteNavigation' , {
                type    : 58 ,
                site_id : this.siteid.site_id || 0
            }).then(res => {
                var data = res.data;
                if( data.code == 1 ){
                    this.serveList = data.data;
                }else{
                    layer.msg(res.data.msg);
                }
            } , err => {
            }).catch(( error ) => {
            });
        }
    } ,
    template : `<div class="life-service">
                   <div class="life-server-img">
                       <div class="life-service-img">
                           <span>生</span>
                           <span>活</span>
                           <span>服</span>
                           <span>务</span>
                       </div>
                   </div>
                   <div class="life-service-list">
                       <div class="life-service-item" v-for="(item,index) in serveList[0].child">
                           <a class="life-service-item-title" :href="item.url">
								<img v-if="item.iconimage_text" class="icon-img" :src="item.iconimage_text">
								<span>{{item.name}}</span>
						   </a>
                           
                       </div>
                   </div>
               </div>`
});
// 系统公告
Vue.component('notice-component' , {
    data(){
        return {
            notice : [],
			tempUrl:tmpsUrls
        };
    } ,
    props    : {
        siteid : {
            type : Object ,
            default(){
                return {};
            }
        } ,
        url    : {
            type    : String ,
            default : "./"
        }
    } ,
    mounted(){
		
        this.getTopSite();
		
    } ,
    methods  : {
        // 获取全部顶级站点
        getTopSite(){
            axios.post(sysurl + 'index/notice' , { site_id : this.siteid.site_id || 0 }).then(res => {
                var data = res.data;
                if( data.code === 1 ){
                    this.notice = data.data.data;
                }else{
                    layer.msg(res.data.msg);
                }
            } , err => {
            }).catch(( error ) => {
            });
        }
    } ,
    template : `<div class="notice">
                    <div class="notice-title">
                        <div class="notice-logo" :style="{ 'background-image' : 'url(' +  url + 'static/images/圆角矩形9.png)' }">服务公告</div>
                    </div>
                    <div class="notice-content">
						<div class="text-list" v-for="item in notice" :key="item.id">
							<a class="nitice-title" :href="tempUrl+'www/views/about/public.html#/noticedetail?id='+item.id">{{item.title}}</a>
						</div>
                    </div>
                </div>`
});
// 家园调查
Vue.component('survey-component' , {
    data(){
        return {
            surveyList : "" ,              // 调查数据列表
            tipOffWay  : "",
			siteinfo:{},
			sitelevel:'',
			did:39,
			bid:34,
			cid:192,
			tid:197
        };
    } ,
    props    : {
        siteid : {
            type : Object ,
            default(){
                return {};
            }
        } ,
        url    : {
            type    : String ,
            default : "./"
        }
    } ,
    mounted(){
		this.siteinfo = JSON.parse(localStorage.getItem("siteInfo"))
		this.sitelevel = this.siteinfo.site_level<3?this.siteinfo.site_level+1:3
		if(this.sitelevel == 1){
			this.did = 39
			this.bid = 34
			this.cid = 192
			this.tid = 197
		}else if(this.sitelevel == 2){
			this.did = 173
			this.bid = 180
			this.cid = 204
			this.tid = 209
		}else{
			this.did = 216
			this.bid = 185
			this.cid = 214
			this.tid = 215
		}
		
        this.getSurveyList();
        this.getComplainList();
    } ,
    methods  : {
        // 获取家园调查4条数据
        getSurveyList(){
            let site;
            if( this.siteid ){
                site = this.siteid.site_id || 0;
            }else{
                site = 0
            }
            axios.post(sysurl + 'index/survey' , { site_id : site || 0 }).then(res => {
                var data = res.data;
                if( data.code === 1 ){
                    this.surveyList = data.data;
                }else{
                    layer.msg(res.data.msg);
                }
            } , err => {}).catch(( error ) => {});
        } ,
        // 获取投诉列表
        getComplainList(){
            axios.post(sysurl + 'index/tipOffWay' , {site_id:localStorage.getItem("siteInfo").site_id}).then(res => {
                if( res.data.code === 1 ){
                    this.tipOffWay = res.data.data[ 0 ];
                }else{
                    layer.msg(res.data.msg);
                }
            } , err => {}).catch(( error ) => {});
        }
    } ,
    template : `<div class="investigation">
                   <div class="investigation-tab">
                       <a class="tab-item" :href="url + 'views/about/public.html?id='+bid+'&station_type='+this.sitelevel+'&banner_type=0'">
                           <div class="tab-item-header"><img :src=" url + 'static/icons/问题.png'">卜咚问问</div>
                           <div class="tab-item-text">
                               实时为您解答，卜咚
                               问问您身边的社区管家
                           </div>
                       </a>
                       <a class="tab-item" :href="url+'views/about/public.html?id='+cid+'&station_type='+this.sitelevel+'&banner_type=0'"> 
                           <div class="tab-item-header"><img :src=" url + 'static/icons/互动.png'">城乡互动</div>
                           <div class="tab-item-text">
                               民主，公平，公开，
                               透明化选举信息
                           </div>
                       </a>
                       <a class="tab-item" :href="url + 'views/about/public.html?id='+did+'&station_type='+this.sitelevel+'&banner_type=0'">
                           <div class="tab-item-header"><img :src=" url + 'static/icons/调查.png'">家园调查</div>
                           <div class="tab-item-text">
                               实时为您解答，卜咚
                               问问您身边的社区管家
                           </div>
                       </a>
                       <a class="tab-item" :href="url + 'views/about/public.html?id='+tid+'&station_type='+this.sitelevel+'&banner_type=0'">
                           <div class="tab-item-header"><img :src=" url + 'static/icons/投诉.png'">投诉建议</div>
                           <div class="tab-item-text">
                               向本平台总部提交投诉建议内容
                           </div>
                       </a>
                   </div>
                   <div class="investigation-list">
                       <div class="investigation-list-title">
                           <span>家</span>
                           <span>园</span>
                           <span>调</span>
                           <span>查</span>
                       </div>
                       <div class="investigation-comment">
                           <div class="investigation-comment-item">
                               <a :href="url + 'views/about/public.html?id='+did+'&station_type='+this.sitelevel+'&banner_type=0'" v-if="surveyList && surveyList.hot" class="investigation-comment-item-link" 
                                  :data-id="surveyList.hot.id" v-text="surveyList.hot.title"></a>
                           </div>
                           <div class="investigation-comment-item">
                               <a :href="url + 'views/about/public.html?id='+did+'&station_type='+this.sitelevel+'&banner_type=0'" class="investigation-comment-item-link" v-if="surveyList && surveyList.campaign"
                                  :data-id="surveyList.campaign.id" v-text="surveyList.campaign.title"></a>
                           </div>
                           <div class="investigation-comment-item">
                               <a :href="url + 'views/about/public.html?id='+did+'&station_type='+this.sitelevel+'&banner_type=0'" class="investigation-comment-item-link" v-if="surveyList && surveyList.vote"
                                  :data-id="surveyList.vote.id" v-text="surveyList.vote.title"></a>
                           </div>
                           <div class="investigation-comment-item">
                               <a :href="url + 'views/about/public.html?id='+did+'&station_type='+this.sitelevel+'&banner_type=0'" class="investigation-comment-item-link" v-if="surveyList && surveyList.active"
                                  :data-id="surveyList.active.id" v-text="surveyList.active.title"></a>
                           </div>
                       </div>
                   </div>
               </div>`
});
/* 配置站点 **********************************/

/* 家园调查 组件*/
// 焦点
Vue.component('focus-component' , {
    data(){
        return {
            articleList : [] ,                // 文章数据列表
            total       : 0 ,              // 数据总条数
            limit       : 10 ,             // 每页显示条数
            page        : 1 ,              // 当前页码
            pagegroup   : 0                // 总页码
        };
    } ,
    props    : {
        url : {
            type    : String ,
            default : "./views/home"
        },
        siteid : {
            type : Object ,
            default(){
                return {};
            }
        }
    } ,
    mounted(){
        this.getArticleList();
    } ,
    methods  : {
        // 获取文章列表
        getArticleList(){
            if( this.page == 1 ){
                this.articleList = [];
            };
            axios.post(sysurl + 'article/areaArticleList' , {
                site_id:this.siteid.site_id || 0,
                category_id:76,
                limit : this.limit ,
                page  : this.page
            }).then(res => {
                var datas = res.data;
                if( datas.code === 1 ){
                    this.articleList = datas.data.data;
                    if( datas.data.current_page == 1 && datas.data.total > 0 ){
                        this.total     = datas.data.total;
                        this.pagegroup = datas.data.last_page;
                    }
                }else{
                    layer.msg(res.data.msg);
                }
            } , err => {}).catch(( error ) => {});
        } ,
        // 分页
        togglePage( page ){
            this.page = page || this.page;
            this.getArticleList();
        }
    } ,
    template : `<div class="article">
                    <div class="article-header">
                        <div class="article-header-inner">
                            <div class="article-logo"></div>
                            <div class="article-tip">焦点</div>
                        </div>
                        <div class="article-hot">HOT</div>
                    </div>
                    <div class="article-list">
                        <a class="article-list-item" v-for="(item,index) in articleList" :href="'../../views/home/article.html?id=' + item.id + '&category_name=焦点'">
                            <div class="article-item-img" :style="{'background-image' : 'url(' + item.coverimages_text[0] +')'}"></div>
                            <div class="article-item-content" style="width: 46rem">
                                <div class="article-item-title">{{item.title}}</div>
                                <div class="article-item-prop">
                                    <span v-if="item.resource">{{item.resource}}</span>
                                    <span v-if="item.publishtime_text">发布于：{{item.publishtime_text}}</span>
                                    <span v-if="item.comment">评论：{{item.comment}}</span>
                                </div>
                                <div class="article-item-text">{{item.postcontent | textFilter}}</div>
                            </div>
                        </a>
                    </div>
                    <v-pagination v-if="total" :total="total" :display="limit" :currentPage="page" @pagechange="togglePage"></v-pagination>
                </div>`,
    filters:{
        // 过滤中文
        textFilter(txt){
            var str;
            str = txt.match(regHtml,"");
            return str.join("");
        }
    },
});
// 竞选投票详情
Vue.component('runfor-component' , {
    data(){
        return {
            token      : getCookie("token") ,       // 用户token
            user_id    : getCookie("user_id") ,   // 用户id
            voteDetail : "" ,                  // 当前投票数据
            userList   : [] ,                    // 用户id 列表
            hover      : false                     // 显示按钮
        };
    } ,
    props    : {
        vite   : {
            type : Object ,
            default(){
                return {};
            }
        } ,
        siteid : {
            type : Object ,
            default(){
                return {};
            }
        }
    } ,
    mounted(){
        this.getViteDetail();
    } ,
    methods  : {
        /**
         *  去投票并获取投票详情
         *  id   : 投票id
         *  type : 投票类型
         *  */
        getViteDetail(){
            var data = transFormData({
                user_id : this.user_id ,
                token   : this.token ,
                site_id : this.siteid.site_id || 0 ,
                vote_id : this.vite.id
            });
            axios.post(sysurl + 'vote/campaignVote' , data).then(res => {
                var datas = res.data;
                if( datas.code === 1 ){
                    datas.data.campaign.map(function( item , index ){
                        item.hover = false;
                    });
                    this.voteDetail = datas.data;
                }else{
                    layer.msg(res.data.msg);
                }
            } , err => {
            }).catch(( error ) => {
            });
        } ,
        // 选中 或 取消选中用户
        chageVoteUser( item , index ){
            var sub = this.userList.indexOf(item.id);
            if( sub == -1 ){
                if( this.userList.length == this.voteDetail.vote_limit ){
                    layer.msg("投票次数限制");
                    return false;
                }
                this.userList.push(item.id);
                item.vote_numer++;
            }else{
                this.userList.splice(sub , 1);
                item.vote_numer--;
            }
            item.choose = !item.choose;
        } ,
        mouseeEvent( item , type ){
            item.hover = type;
            // console.log(item , type);
        } ,
        // 提交投票
        submitVote( data ){
            var data = transFormData({
                user_id      : this.user_id ,
                token        : this.token ,
                site_id      : this.siteid.site_id || 0 ,
                vote_id      : this.voteDetail.id ,
                campaign_ids : this.userList.join(",")
            });
            axios.post(sysurl + 'vote/campaignBet' , data).then(res => {
                var datas = res.data;
                if( datas.code === 1 ){
                    layer.msg(res.data.msg);
                	// 更新投票
					this.getViteDetail();
                }else{
                    layer.msg(res.data.msg);
                }
            } , err => {
            }).catch(( error ) => {
            });
        } ,
        // 显示人员信息
        showUserInfo( data ){
            this.$emit("userinfo" , data);
        }
    } ,
    template : `<div class="campaign-item"> 
                        <div class="campaign-item-title">{{voteDetail.title}}</div>
                        <div class="campaign-item-prop">
                            <span>发起人：{{voteDetail.resource}}</span>
                            <span>时间：{{voteDetail.starttime_text}} - {{voteDetail.endtime_text}}</span>
                            <span>浏览次数：{{voteDetail.browse}}次</span>
                        </div>
                        <div class="campaign-item-content">
                            <div class="campaign-item-inner" v-for="(item,index) in voteDetail.campaign">
                                <div class="campaign-item-img"  data-toggle="modal" data-target="#myModal"
                                    :style="{ 'background-image' : 'url('+ item.avatar_text +')' }"
                                    @click="showUserInfo(item)">
                                </div>
                                <div class="campaign-item-name">{{item.name}}</div>
                                <div class="campaign-item-intro">{{item.job}}</div>
                                <div class="campaign-item-btn" :class="{ 'active' : item.choose || item.hover }" v-show="!voteDetail.choose" 
                                    @click="chageVoteUser(item,index)"
                                    @mouseenter="mouseeEvent(item,true)"
                                    @mouseleave="mouseeEvent(item,false)">
                                    <div class="zan" v-show="!item.hover">
                                        <img src="../../static/icons/票.png">
                                        <span>{{ item.vote_numer }}票</span>
                                    </div>
                                    <div class="zan" v-show="item.hover">
                                        <img src="../../static/icons/点赞1.png">
                                        <span>{{ item.choose ? '取消投票' : '给他投票'}}</span>
                                    </div>
                                </div>
                                <div class="campaign-item-btn" :class="{ 'active' : item.choose }" v-show="voteDetail.choose">
                                    <div class="zan">
                                        <img src="../../static/icons/票.png">
                                        <span>{{ item.vote_numer }}票</span>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="campaign-item-submit">
                            <span @click="submitVote()" v-if="!voteDetail.choose">
                                （<font color="#FE7600">{{userList.length}}</font>/{{voteDetail.vote_limit}}）提交选票
                            </span>
                            <span v-if="voteDetail.choose">已投票</span>
                        </div>
                    </div>`
});
// 活动投票详情
Vue.component('activity-component' , {
    data(){
        return {
            token      : getCookie("token") ,       // 用户token
            user_id    : getCookie("user_id") ,   // 用户id
            voteDetail : "" ,                  // 当前投票数据
            userList   : []                     // 用户id 列表
        };
    } ,
    props    : {
        vite   : {
            type : Object ,
            default(){
                return {};
            }
        } ,
        siteid : {
            type : Object ,
            default(){
                return {};
            }
        },
		defaultway: {
			type:Number,
			default(){
				return 1
			}
		}
    } ,
    mounted(){
        this.getViteDetail();
    } ,
    methods  : {
        /**
         *  去投票并获取投票详情
         *  id   : 投票id
         *  type : 投票类型
         *  */
        getViteDetail(){
            var data = transFormData({
                user_id : this.user_id ,
                token   : this.token ,
                site_id : this.siteid.site_id || 0 ,
                vote_id : this.vite.id
            });
            axios.post(sysurl + 'vote/activeVoteDetail' , data).then(res => {
                var datas = res.data;
                if( datas.code === 1 ){
                    this.voteDetail = datas.data;
                    // console.log(this.voteDetail);
                }else{
                    layer.msg(res.data.msg);
                }
            } , err => {
            }).catch(( error ) => {
            });
        } ,
        // 活动投票
        activeVoteBet( type ){
            var data = transFormData({
                user_id       : this.user_id ,
                token         : this.token ,
                site_id       : this.siteid.site_id || 0 ,
                vote_id       : this.vite.id ,
                child_vote_id : this.voteDetail.child_vote.id ,
                typedata      : parseInt(type),
				way:this.defaultway
            });
            axios.post(sysurl + 'vote/activeVoteBet' , data).then(res => {
                var datas = res.data;
                if( datas.code === 1 ){
                    layer.msg(res.data.msg);
                    this.getViteDetail();
                }else{
                    layer.msg(res.data.msg);
                }
            } , err => {
            }).catch(( error ) => {
            });
        }
    } ,
    template : `<div class="investigation-item">
                        <div class="investigation-item-title">{{voteDetail.title}}</div>
                        <div class="investigation-item-prop">
                            <span>发起人：{{voteDetail.resource}}</span>
                            <span>时间：{{voteDetail.starttime_text}}</span>
                            <span>浏览次数：{{voteDetail.browse}}次</span>
                        </div>
                        <div class="investigation-event-text" v-if="voteDetail.child_vote && voteDetail.child_vote.votecontent" v-html="voteDetail.child_vote.votecontent"></div>
                        <div class="investigation-event-option">
                            <span class="span1" @click="activeVoteBet(1)">
                                <img src="../../static/icons/点赞1.png">
                                赞同({{ voteDetail.child_vote && voteDetail.child_vote.agree ? voteDetail.child_vote.agree : 0 }})
                            </span>
                            <span class="span3" @click="activeVoteBet(2)">
                                <img src="../../static/icons/反对.png">
                                反对({{ voteDetail.child_vote && voteDetail.child_vote.against ? voteDetail.child_vote.against : 0 }})
                            </span>
                        </div>
                    </div>`
});
// 评议投票详情
var discuss = Vue.component('discuss-component' , {
    data(){
        return {
            token      : getCookie("token") ,       // 用户token
            user_id    : getCookie("user_id") ,   // 用户id
            voteDetail : "" ,                  // 当前投票数据
            userList   : []                     // 用户id 列表
        };
    } ,
    props    : {
        vite   : {
            type : Object ,
            default(){
                return {};
            }
        } ,
        siteid : {
            type : Object ,
            default(){
                return {};
            }
        }
    } ,
    mounted(){
        this.getViteDetail();
    } ,
    methods  : {
        /**
         *  去投票并获取投票详情
         *  id   : 投票id
         *  type : 投票类型
         *  */
        getViteDetail(){
            var data = transFormData({
                user_id : this.user_id ,
                token   : this.token ,
                site_id : this.siteid.site_id || 0 ,
                vote_id : this.vite.id
            });
            axios.post(sysurl + 'vote/deliberateVote' , data).then(res => {
                var datas = res.data;
                if( datas.code === 1 ){
                    this.voteDetail = datas.data;
                    // console.log(this.voteDetail);
                }else{
                    layer.msg(res.data.msg);
                }
            } , err => {}).catch(( error ) => {});
        } ,
        // 活动投票
        discussVoteBet( type , id ){
            var data = transFormData({
                user_id       : this.user_id ,
                token         : this.token ,
                site_id       : this.siteid.site_id || 0 ,
                vote_id       : this.vite.id ,
                child_vote_id : parseInt(id) ,
                typedata      : parseInt(type)
            });
            axios.post(sysurl + 'vote/deliberateBet' , data).then(res => {
                var datas = res.data;
                if( datas.code === 1 ){
                    this.getViteDetail.bind(this)()
                    layer.msg(res.data.msg);
                }else{
                    layer.msg(res.data.msg);
                }
            } , err => {}).catch(( error ) => {});
        }
    } ,
    template : `<div class="discuss campaign-item">
                        <div class="campaign-item-title">{{voteDetail.title}}</div>
                        <div class="campaign-item-prop">
                            <span>发起人：{{voteDetail.resource}}</span>
                            <span>时间：{{voteDetail.starttime_text}} - {{voteDetail.endtime_text}}</span>
                            <span>浏览次数：{{voteDetail.browse || 0}}次</span>
                        </div>
                        <div class="investigation-item" v-for="(item,index) in voteDetail.child_vote" >
                            <div class="investigation-event">
                                <div class="investigation-event-num">{{index + 1}}</div>    
                                <div class="investigation-event-name">{{item.title}}</div>
                            </div>
                            <div class="investigation-event-text" v-html="item.votecontent"></div>
                            <div class="investigation-event-option">
                                <span class="span1" @click="discussVoteBet(1,item.id)">
                                    <img src="../../static/icons/点赞1.png" alt="">
                                    赞同({{item.agree || 0}})
                                </span>
                                <span class="span2" @click="discussVoteBet(3,item.id)">
                                    不关心({{item.notcare || 0}})
                                </span>
                                <span class="span3" @click="discussVoteBet(2,item.id)">
                                    <img src="../../static/icons/反对.png" alt="">
                                    反对({{item.against || 0}})
                                </span>
                            </div>
                        </div>
                    </div>`
});
// 征集详情
Vue.component('collect-component' , {
    data(){
        return {
            token      : getCookie("token") ,       // 用户token
            user_id    : getCookie("user_id") ,   // 用户id
            voteDetail : "" ,                  // 当前投票数据
            userList   : []                     // 用户id 列表
        };
    } ,
    props    : {
        vite   : {
            type : Object ,
            default(){
                return {};
            }
        } ,
        siteid : {
            type : Object ,
            default(){
                return {};
            }
        }
    } ,
    mounted(){
        this.getViteDetail();
    } ,
    methods  : {
        /**
         *  去投票并获取投票详情
         *  id   : 投票id
         *  type : 投票类型
         *  */
        getViteDetail(){
            axios.post(sysurl + 'vote/collectDetail' , { collect_id : this.vite.id }).then(res => {
                var datas = res.data;
                if( datas.code === 1 ){
                    this.voteDetail = datas.data;
                }else{
                    layer.msg(res.data.msg);
                }
            } , err => {}).catch(( error ) => {});
        }
    } ,
    template : `<div class="investigation-item">
                        <div class="investigation-item-title">{{voteDetail.title}}</div>
                        <div class="investigation-item-prop">
                            <span>发起人：{{voteDetail.source || '未知'}}</span>
                            <span>时间：{{voteDetail.createtime_text}}</span>
                            <span>浏览次数：{{voteDetail.reading}}次</span>
                        </div>
                        <div class="investigation-event-text" v-html="voteDetail.postcontent"></div>
                        <comment-component v-if="vite && vite.id" type="collect" :commentid="parseInt(vite.id)" :siteid="siteid"></comment-component>
                    </div>`
});
// 查看人员信息
Vue.component('userdate-component' , {
    data(){
        return {
            token      : getCookie("token") ,       // 用户token
            user_id    : getCookie("user_id") ,   // 用户id
            voteDetail : "" ,                  // 当前投票数据
            userList   : []                     // 用户id 列表
        };
    } ,
    props    : {
        userinfo : {
            type : Object ,
            default(){
                return {};
            }
        } ,
        siteid   : {
            type : Object ,
            default(){
                return {};
            }
        }
    } ,
    mounted(){
        // console.log(this.userinfo);
    } ,
    methods  : {} ,
    template : `<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-hidden="true">
                        <div class="modal-dialog modal-dialog-centered" role="document">
                            <div class="modal-content">
                                <div class="modal-body">
                                    <div class="info-box">
                                        <div class="info-header-img" :style="{ 'background-image' : 'url('+ userinfo.avatar_text +')' }"></div>
                                        <div class="info-list">
                                            <div class="info-text">姓名：{{userinfo.name}}</div>
                                            <div class="info-text">年龄：{{userinfo.age}}</div>
                                            <div class="info-text">民族：{{userinfo.nation}}</div>
                                            <div class="info-text">政治面貌：{{userinfo.politic_text}}</div>
                                        </div>
                                    </div>
                                    <div class="info-data">
                                        <div class="info-title">资料介绍：<span></span></div>
                                        <div class="info-innerText" v-html="userinfo.introduction"></div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>`
});
/* 家园调查 组件*/
/*评论列表及回复*/
// 评议投票详情
Vue.component('comment-component' , {
    data(){
        return {
            token       : getCookie("token") ,       // 用户token
            user_id     : getCookie("user_id") ,   // 用户id
            commentVal  : "" ,                 // 评论输入内容
            commentList : "" ,                // 评论列表
            pagegroup   : 1 ,                   // 评论总页码
            total       : 0 ,                       // 评论总条数
            page        : 1                         // 评论页码
        };
    } ,
    props    : {
        siteid    : {
            type : Object ,
            default(){
                return {};
            }
        } ,
        limit     : {
            type    : Number ,
            default : 10
        } ,
        type      : {
            type    : String ,
            default : "article"
        } ,
        commentid : {}
    } ,
    mounted(){
        this.togglePage();
    } ,
    methods  : {
        //评论
        commentSend(){
            var url  = "";
            var data = {};
            if( !this.commentVal ){
                layer.msg("请输入评论内容");
                return false;
            }
            if( this.type == 'article' ){                     // 文章-评论发布
                url  = "article/commentAdd";
                data = transFormData({
                    user_id    : this.user_id ,
                    token      : this.token ,
                    site_id    : this.siteid.site_id || 0,
                    article_id : this.commentid ,
                    content    : this.commentVal
                });
            }
            if( this.type == "asking" ){                      // 卜咚问问-回复
                url  = "asking/answered";
                data = transFormData({
                    user_id   : this.user_id ,
                    token     : this.token ,
                    site_id   : this.siteid.site_id || 0,
                    asking_id : this.commentid ,
                    content   : this.commentVal
                });
            }
            if( this.type == 'collect' ){                    // 征集-回复
                url  = "vote/answered";
                data = transFormData({
                    user_id    : this.user_id ,
                    token      : this.token ,
                    site_id    : this.siteid.site_id || 0,
                    collect_id : this.commentid ,
                    content    : this.commentVal
                });
            }
            this.commentIssue(url , data);
        } ,
        // 文章-评论发布
        commentIssue( url , data ){
            axios.post(sysurl + url , data).then(res => {
                var datas = res.data;
                if( datas.code === 1 ){
                    layer.msg("评论发表成功");
                    this.page       = 1;
                    this.commentVal = "";
                    this.togglePage();
                }else{
                    layer.msg(res.data.msg);
                }
            } , err => {
            }).catch(( error ) => {
            });
        } ,
        /*TODO 评论列表 与 回复操作分割线***************************************************************************************/

        // 文章评论列表
        getCommentList( url , data ){
            axios.post(sysurl + url , data).then(res => {
                var datas = res.data;
                if( datas.code === 1 ){
                    this.commentList = datas.data.data;
                    // console.log(this.commentList);
                    if( datas.data.current_page == 1 && datas.data.total > 0 ){
                        this.total     = datas.data.total;
                        this.pagegroup = datas.data.last_page;
                    }
                }else{
                    layer.msg(res.data.msg);
                }
            } , err => {
            }).catch(( error ) => {
            });
        } ,
        // 分页
        togglePage( page ){
            this.page = page || this.page;
            var url   = "";
            var data  = {};
            if( this.type == 'article' ){                     // 文章 - 评论列表
                url  = "article/commentList";
                data = {
                    article_id : this.commentid ,
                    limit      : this.limit ,
                    page       : this.page
                };
            }
            if( this.type == "asking" ){                      // 卜咚问问 - 评论列表
                url  = "asking/back";
                data = {
                    asking_id : this.commentid ,
                    limit     : this.limit ,
                    page      : this.page
                };
            }
            if( this.type == 'collect' ){                     // 征集 - 评论列表
                url  = "vote/collectBack";
                data = {
                    collect_id : this.commentid ,
                    limit      : this.limit ,
                    page       : this.page
                };
            }
            this.getCommentList(url , data);
        }
    } ,
    template : `<div class="article-comment">
                    <div class="article-comment-input">
                        <div class="article-input-box">
                            <textarea name="" id="" cols="30" rows="8" maxlength="200" v-model="commentVal" placeholder="请输入评论内容"></textarea>
                            <span>{{commentVal.length}}/200</span>
                        </div>
                    </div>
                    <div class="article-tip">
                        <span class="article">评论</span>
                        <button class="" @click="commentSend">发送</button>
                    </div>
                    <div class="article-comment-item" v-for="(item,index) in commentList">
                        <div class="article-comment-item-header" v-if="item.user">
                            <div class="article-comment-item-logo" v-if="item.user.avatar" 
                                :style="{ 'background-image' : 'url('+ ( item.user.avatar || '../../static/icons/头像moen.png' ) +')' }">    
                            </div>
                            <div class="article-comment-item-name" v-if="item.user.username">{{item.user.username}}</div>
                        </div>
                        <div class="article-comment-item-header" v-else>
                            <div class="article-comment-item-logo"></div>
                            <div class="article-comment-item-name">一名热心的网友</div>
                        </div>
                        <div class="article-comment-item-time">{{item.createtime_text}}</div>
                        <div class="article-comment-item-text" v-html="item.content"></div>
                    </div>
                    <v-pagination v-if="total" :total="total" :display="limit" :currentPage="page" :pagegroup="pagegroup" @pagechange="togglePage"></v-pagination>
                </div>`
});
/*评论回复*/




// 留言列表
Vue.component('message-component' , {
    data(){
        return {
            token       : getCookie("token") ,       // 用户token
            user_id     : getCookie("user_id") ,   // 用户id
            commentVal  : "" ,                 // 评论输入内容
            commentList : "" ,                // 评论列表
            pagegroup   : 1 ,                   // 评论总页码
            total       : 0 ,                       // 评论总条数
            page        : 1                         // 评论页码
        };
    } ,
    props    : {
        siteid    : {
            type : Object ,
            default(){
                return {};
            }
        } ,
        limit     : {
            type    : Number ,
            default : 10
        } ,
        type      : {
            type    : String ,
            default : "0"
        } ,
        commentid : {}
    } ,
    mounted(){
        this.togglePage();
    } ,
    methods  : {
      

        // 文章评论列表
        getCommentList( url , data ){
            axios.post(sysurl + url , data).then(res => {
                var datas = res.data;
                if( datas.code === 1 ){
                    this.commentList = datas.data.data;
                    // console.log(this.commentList);
                    if( datas.data.current_page == 1 && datas.data.total > 0 ){
                        this.total     = datas.data.total;
                        this.pagegroup = datas.data.last_page;
                    }
                }else{
                    layer.msg(res.data.msg);
                }
            } , err => {
            }).catch(( error ) => {
            });
        } ,
        // 分页
        togglePage( page ){
            this.page = page || this.page;
            var url   = "";
            var data  = {};
			console.log(this.type)
                              // 文章 - 评论列表
                url  = "index/guestbookList";
                data = {
                    type : this.type ,
                    site_id : this.siteid.site_id||0 ,
                    limit      : this.limit ,
                    page       : this.page
                };
            
            
            this.getCommentList(url , data);
        }
    } ,
    template : `<div class="article-comment">
                   
                    
                    <div class="article-comment-item" v-for="(item,index) in commentList">
                        <div class="article-comment-item-header" v-if="item.user">
                            <div class="article-comment-item-logo" v-if="item.user.avatar_text" 
                                :style="{ 'background-image' : 'url('+ ( item.user.avatar_text || '../../static/icons/头像moen.png' ) +')' }">    
                            </div>
                            <div class="article-comment-item-name" v-if="item.user.username">{{item.user.username}}</div>  <span style="font-size:0.8rem;margin-left:2rem;color:#999">发布时间：{{item.createtime_text}}</span>
                        </div>
                       
                        <div class="article-comment-item-time">{{item.title}}</div>
                        <div class="article-comment-item-text" v-html="item.messagecontent"></div>
                    </div>
                    <v-pagination v-if="total" :total="total" :display="limit" :currentPage="page" :pagegroup="pagegroup" @pagechange="togglePage"></v-pagination>
                </div>`
});





// 站点数据
Vue.component('site-component' , {
    data(){
        return {
            siteTop : ""
        };
    } ,
    props    : {
        id  : {
            type : Object ,
            default(){
                return {};
            }
        } ,
        url : {
            type    : String ,
            default : "../../"
        }
    } ,
    mounted(){
        this.getTopSite();
    } ,
    methods  : {
        // 获取全部顶级站点
        getTopSite(){
            axios.post(sysurl + 'common/siteFive' , {}).then(res => {
                var data = res.data;
                if( data.code === 1 ){
                    this.siteTop = data.data;
                }else{
                    layer.msg(res.data.msg);
                }
            } , err => {
            }).catch(( error ) => {
            });
        }
    } ,
    template : `<div class="Administrative">
                    <div class="admin-header">
                        <div class="admin-name">按行政区划查找站点</div>
                        <div class="admin-tips" style="color: rgba(255,107,20,1)">
                            查找不到的站点请 
                            <a :href="url + 'views/login/register-station.html'" style="color:rgba(34,165,240,1)">注册自助建站</a>
                            ，或联系总部服务
                        </div>
                    </div>
                    <div class="admin-box">
    <!--                    <a href="" data-toggle="modal" data-target="#myModal2">北京</a>-->
                        <a :href="url + 'views/home/select-site.html?id=' + item.id + '&name=' + item.name + 
                            '&site_id=' + item.site_id + '&site_level=' + item.site_level + '&sitename=' + item.sitename" 
                            v-for="item in siteTop">{{item.name}}</a>
                    </div>
                </div>`
});
/**
 * 提问
 */
var newquestion   = Vue.component('newquestion' , {
    data     : function(){
        return {
            count      : 0 ,
            defaultMsg : '' ,
            config     : {
                initialFrameWidth  : 650 ,
                initialFrameHeight : 350
            } ,
            siteid     : '' ,
            title      : ''
        };
    } ,
    created(){
        if( localStorage.getItem('station') ){
            //判断站点
            this.siteid = JSON.parse(localStorage.getItem('station')).site_id;
        }else{
			this.siteid = 0;
            //layer.msg('无法获取站点信息');
        }
    } ,
    mounted(){

    } ,
    methods  : {
        getUEContent( _this ){
            let content = _this.$refs.ue.getUEContent();
            return content;
        } ,
        tijiao(){
            let m = this.getUEContent(this);
            if( m ){
                let d = new FormData();
                d.append('user_id' , getCookie('user_id'));
                d.append('token' , getCookie('token'));
                d.append('site_id' , this.siteid);
                d.append('title' , this.title);
                d.append('postcontent' , m);
                axios.post(sysurl + 'asking/addAsking' , d).then(res => {
                    if( res.data.code == 1 ){
                        layer.msg('提交成功');
                        Object.assign(this.$data , this.$options.data());
                        this.$refs.ue.setUEContent('');
                    }else{
                        layer.msg(res.data.msg);
                    }
                });
            }else{
                layer.msg('请输入问题描述');
            }
        }
    } ,
    template : `<div class="article-detail-r" id="v-pills-focus" role="tabpanel" aria-labelledby="v-pills-focus-tab">
						<div class="old_show">
							<div class="article-header">
								<div class="article-header-inner">
									<div class="article-logo"></div>
									<div class="article-tip">提出问题</div>
								</div>
								<div class="article-hot">
									New Question
								</div>
							</div>
							<div class="new-question-box">
								<div class="group">
									<div class="left">问题标题：</div>
									<div class="right"><input type="text" name="title" class="auth-input" v-model="title"></div>
								</div>
								<div class="group top">
									<div class="left">问题描述：</div>
									<div class="right">
										<Ueditor :defaultMsg=defaultMsg :config=config ref="ue"></Ueditor>
									</div>
								</div>	
								<div class="add-question" @click="tijiao">提交</div>							
							</div>
						</div>						
					</div>`
});
/**
 * 提问列表
 */
var problemlist   = Vue.component('prolist' , {
    data: function(){
        return {
            count   : 0 ,
            type    : this.$route.query.type ,
            maxpage : 1 ,
            page    : 1 ,
            list    : [] ,
            keyword : "" ,
            data    : {
                site_id  : localStorage.getItem('siteInfo').site_id ,
                keywords : this.keyword ,
                answered : "" ,
                hot      : ""
            } ,
            tag     : {
                en         : 'All Questions' ,
                cn         : '问问列表' ,
                nowstation : localStorage.getItem('station') ? JSON.parse(localStorage.getItem('station')) : ''
            }
        };
    } ,
    watch: {
        '$route':function(){
            let keywords = this.data.keywords || "";
            this.data.keywords = "";
            this.data.answered = "0";
            this.data.hot = "0";
            switch(this.$route.name){
                case 10:
                    this.data.keywords = keywords;
                    this.tag           = {
                        en : 'All Questions' ,
                        cn : '问问列表'
                    };
                    break;
                case 11:
                    this.data.hot      = 1;
                    this.data.keywords = keywords;
                    this.tag           = {
                        en : 'HOT Questions' ,
                        cn : '热门问题'
                    };
                    break;
                case 13:
                    this.data.answered = 1;
                    this.data.keywords = keywords;
                    this.tag           = {
                        en : 'Questions to be answered' ,
                        cn : '待答问题'
                    };
                    break;
            }
            this.getlist(this.data);
        }
    } ,
    mounted(){
        let keywords = this.data.keywords || "";
        this.data.keywords = "";
        this.data.answered = "0";
        this.data.hot = "0";
        switch(this.$route.name){
            case 10:
                this.data.keywords = keywords;
                this.tag           = {
                    en : 'All Questions' ,
                    cn : '问问列表'
                };
                break;
            case 11:
                this.data.hot      = 1;
                this.data.keywords = keywords;
                this.tag           = {
                    en : 'HOT Questions' ,
                    cn : '热门问题'
                };
                break;
            case 13:
                this.data.answered = 1;
                this.data.keywords = keywords;
                this.tag           = {
                    en : 'Questions to be answered' ,
                    cn : '待答问题'
                };
                break;
        }
        // this.getlist(this.data);
        if(localStorage.getItem('station') ){
            //判断站点
            this.data.site_id = localStorage.getItem('station') ? JSON.parse(localStorage.getItem('station')).site_id : 0;
			this.getlist(this.data);
		}else{
        	this.getlist()
        }
    } ,

	filters:{
		// 过滤中文
		textFilter(txt){
			var str;
			str = txt.match(regHtml,"");
			if (str){
				return str.join("");
			} else{
				return str
			}

		}
	},
    methods  : {
        getlist : function( obj ){
			let that = this;
            let d = new FormData();
            if(obj){
				
				console.log(obj)
                d.append('site_id' , obj.site_id || "");
                d.append('keywords' , obj.keywords || "");
                d.append('answered' , obj.answered || "");
                d.append('hot' , obj.hot || 1);
                d.append('page' , obj.page || 1);
            }
           that.$nextTick(()=>{
			   axios.post(sysurl + 'asking/askingList' , d).then(res => {
			       // console.log(res);
			       that.list = res.data.data.data;
			   });
		   })
            

        } ,
        search  : function(){
            // console.log(this.data , this.keyword);
            this.data.page     = 1;
            this.data.keywords = this.keyword;
            this.getlist(this.data);
        } ,
        detail  : function(){
            this.$router.push({ name : '/detail' });
        }
    } ,
    template : `<div class="article-detail-r" id="v-pills-focus" role="tabpanel" aria-labelledby="v-pills-focus-tab">
						<div class="old_show">
							<div class="article-header">
								<div class="article-header-inner">
									<div class="article-logo"></div>
									<div class="article-tip">{{ tag.cn }}</div>
								</div>
								<div class="article-hot">
									{{ tag.en }}
								</div>
							</div>
							<div class="problem-box">
								<div class="problem-search">
									<div class="search-input">
										<img src="../../static/icons/搜索(2).png" alt="">
										<input type="text" v-model="keyword" placeholder="成都居住证办理流程" @keyup.enter="search"  >
										<div class="input-position">
											<a>热门搜索：</a>
											<a>蓝湖橘郡</a>
											<a>尚品C经</a>
											<a>英郡icon</a>
										</div>
									</div>
									<div class="search-btn" v-if="false" onclick="javascript:window.location.href='../../views/home/search.html'">搜索</div>
									<div class="search-btn" @click="search" >搜索</div>
								</div>
								<div class="problem-search-item" v-for="item in list">
									<div class="problem-search-item-title">{{ item.title }}</div>
									<div class="problem-search-item-prop">
										<span v-if="item.resource">{{ item.resource }}</span>
										<span>发布于：{{ item.createtime_text }}</span>
									</div>
									<div class="problem-search-item-text">
										{{ item.postcontent | textFilter }}
									</div>
									<div class="problem-search-item-option">
										<span>{{ item.comment|| 0 }}人回答</span>
										<span>{{ item.reading|| 0 }}次浏览</span>
										<!--<span>回复</span>-->
										<!--<span @click="detail">回复</span>-->
										<router-link :to="{name:'problemdetail',query:{id:item.id}}" tag="span">回答</router-link>
									</div>
								</div>
							</div>
						</div>						
					</div>`
});
/**
 * 提问详情
 */
var problemdetail = Vue.component('prodetail' , {
    data     : function(){
        return {
            count   : 0 ,
            detail  : '' ,
            reply   : '' ,
            list    : [] ,
            total   : 1 ,
            page    : 1 ,
            limit   : 5 ,
            site_id : ''
        };
    } ,
    props: [ 'defaulttag' , 'defaultid' , 'icon' ,'isfivesite'] ,
    mounted(){
        this.getdetail();
        this.getlist(this.page);
    } ,
    methods  : {
        getdetail  : function(){
            let that = this;
            let d    = new FormData();
            d.append('asking_id' , this.$route.query.id);
            axios.post(sysurl + 'asking/detail' , d).then(res => {
                // console.log(res);
                that.detail = res.data.data;
                this.addhtml(res.data.data.postcontent);
            });
        } ,
        togglePage : function( e ){
            this.page = e;
            this.getlist(this.page);
        } ,
        getlist    : function( page ){
            let d = new FormData();
            d.append('asking_id' , this.$route.query.id);
            d.append('page' , page);
            d.append('limit' , this.limit);
            let that = this;
            axios.post(sysurl + 'asking/back' , d).then(res => {
                // console.log(res);
                that.total = res.data.data.total;
                that.list  = res.data.data.data;
            });
        } ,
        /***
         * 发送评论
         */
        sendreply  : function(){
            if( this.reply ){
                let d = new FormData();
                d.append('user_id' , getCookie('user_id'));
                d.append('token' , getCookie('token'));
                d.append('asking_id' , this.$route.query.id);
                d.append('content' , this.reply);
                // d.append('site_id',JSON.parse(localStorage.getItem('station')).id);
                d.append('site_id' , this.detail.site_id);
                let that = this;
                axios.post(sysurl + 'asking/answered' , d).then(res => {
                    if( res.data.code == 1 ){
                        layer.msg('回复成功');
                        this.reply = '';
                        this.getlist(this.page);
                    }else{
                        layer.msg(res.data.msg);
                    }
                });
            }else{
                layer.msg('回复内容不可为空');
            }
        } ,
        addhtml( str ){
            $('#question-detail').append(str);
        }
    } ,
    template : `<div class="article-detail-r" id="v-pills-focus" role="tabpanel" aria-labelledby="v-pills-focus-tab">
						<div class="new_show">
							<div class="article-header">
								<div class="article-header-inner">
									<div class="article-logo"></div>
									<div class="article-tip">{{ defaulttag }}</div>
								</div>
								<div class="article-hot">
<!--									{{ this.$route.query.en }}-->
								</div>
							</div>
							<div class="problem-box">

								<div class="problem-search-item">
									<div class="problem-search-item-title">{{ detail.title }}</div>
									<div class="problem-search-item-prop">
										<span v-if="detail.user">{{ detail.user.nickname }}</span>
										<span>发布于：{{ detail.createtime_text }}</span>
									</div>
									<div class="problem-search-item-text" id="question-detail">
									
									</div>
								</div>
								<div class="article-comment">
									<div class="article-tip">回复</div>
									<div class="article-comment-input">
										<div class="article-input-box">
											<textarea name="" id="" cols="30" rows="8" maxlength="200" v-model="reply"></textarea> 
											<span>{{ reply.length||0 }}/200</span>
										</div>
										<button @click="sendreply">发送</button>
									</div>
									<div class="article-comment-item" v-for="re in list">
										<div class="article-comment-item-header">
											<div class="article-comment-item-logo"></div>
											<div class="article-comment-item-name">{{ re.user ?  re.user.username : '' }}</div>
										</div>
										<div class="article-comment-item-time">{{ re.createtime_text }}</div>
										<div class="article-comment-item-text">
											{{ re.content }}
										</div>
										<img src="../../static/images/靠谱.png" class="article-comment-item-great" alt="" v-if="re.is_true==1">
									</div>									
									<v-pagination v-if="total" :total="total" :display="limit" :currentPage="page" v-on:pagechange="togglePage"></v-pagination>
								</div>

							</div>
						</div>
					</div>`
});
/**
 * 站点选择
 * */
Vue.component('stationcheck' , {
    data     : function(){
        return {
            count        : 0 ,
            checkcity    : '请选择注册站点' ,
            citylist_1   : [] ,
            citylist_2   : [] ,
            citylist_3   : [] ,
            citylist_4   : [] ,
            citylist_5   : [] ,
            province_id  : 0 ,
            city_id      : 0 ,
            area_id      : 0 ,
            town_id      : 0 ,
            city_name    : '' ,
            checkindex   : 1 ,
            province     : '' ,
            city         : '' ,
            area         : '' ,
            town         : '' ,
            areavalue    : '' ,
            area_level   : '' ,
            site_area_id : '' ,
            last_id      : 0 ,
            last         : ''
        };
    } ,
    mounted(){
        this.getcity();
    } ,
    methods  : {
        /**
         * 返回指定级
         */
        tocheck   : function( e ){
            // console.log(e);
            switch( e ){
                case 1:
                    this.province_id  = 0;
                    this.city_id      = 0;
                    this.area_id      = 0;
                    this.town_id      = 0;
                    this.province     = '';
                    this.city         = '';
                    this.area         = '';
                    this.town         = '';
                    this.checkindex   = 1;
                    this.site_level   = 1;
                    this.last         = '';
                    this.last_id      = '';
                    this.site_area_id = '';
                    break;
                case 2:
                    this.city_id    = 0;
                    this.area_id    = 0;
                    this.town_id    = 0;
                    this.area       = '';
                    this.town       = '';
                    this.checkindex = 2;
                    this.site_level = 2;
                    this.last       = '';
                    this.last_id    = '';
                    break;
                case 3:
                    this.area_id    = 0;
                    this.town_id    = 0;
                    this.town       = '';
                    this.checkindex = 3;
                    this.site_level = 3;
                    this.last       = '';
                    this.last_id    = '';
                    break;
                case 4:
                    if( this.$attrs.type == 'five' ){
                        // console.log('4级');
                        this.town_id    = 0;
                        this.town       = '';
                        this.checkindex = 4;
                        this.site_level = 4;
                        this.last       = '';
                        this.last_id    = '';
                    }else{
                        return false;
                    }
                    break;
                case 5:
                    return false;
                    break;
            }
            this.getcity();
        } ,
        /**
         * 获取城市列表
         */
        getcity   : function(){
            let data = new FormData();
            data.append('province_id' , this.province_id);
            data.append('city_id' , this.city_id);
            data.append('area_id' , this.area_id);
            data.append('town_id' , this.town_id);
            if( this.$attrs.type == 'five' ){
                axios.post(sysurl + 'common/siteFive' , data).then(res => {
                    this.citylist_1 = res.data.data;
                    this.citylist_2 = res.data.data;
                    this.citylist_3 = res.data.data;
                    this.citylist_4 = res.data.data;
                    this.citylist_5 = res.data.data;
                });
            }else{
                axios.post(sysurl + 'common/areaFour' , data).then(res => {
                    this.citylist_1 = res.data.data;
                    this.citylist_2 = res.data.data;
                    this.citylist_3 = res.data.data;
                    this.citylist_4 = res.data.data;
                });
            }
        } ,
        /**
         * 城市选择
         */
        one       : function( e ){
            this.province_id  = e.target.dataset.id;
            this.checkindex   = 2;
            this.site_level   = 1;
            this.province     = e.target.dataset.name;
            this.site_area_id = e.target.dataset.siteid;
            this.getcity();
        } ,
        two       : function( e ){
            this.city_id      = e.target.dataset.id;
            this.checkindex   = 3;
            this.site_level   = 2;
            this.city         = '/' + e.target.dataset.name;
            this.site_area_id = e.target.dataset.siteid;
            this.getcity();
        } ,
        three     : function( e ){
            this.area_id      = e.target.dataset.id;
            this.checkindex   = 4;
            this.site_level   = 3;
            this.area         = '/' + e.target.dataset.name;
            this.site_area_id = e.target.dataset.siteid;
            this.getcity();
        } ,
        four      : function( e ){
            // console.log(e.target.dataset  ,'此时的');
            this.checkindex   = 5;
            this.site_level   = 4;
            this.town_id      = e.target.dataset.id;
            this.town         = '/' + e.target.dataset.name;
            this.site_area_id = e.target.dataset.siteid;
            this.getcity();
        } ,
        five      : function( e ){
            this.last         = '/' + e.target.dataset.name;
            this.last_id      = e.target.dataset.id;
            this.site_area_id = e.target.dataset.siteid;
        } ,
        /**
         * 确认选择城市
         */
        checkarea : function(){
            this.areavalue = this.province + this.city + this.area + this.town;
            let s          = {
                city  : this.province + this.city + this.area + this.town + this.last ,
                level : this.site_level ,
                id    : this.site_area_id
            };
            this.$emit('returncity' , s);
            // console.log(s);
        }
    } ,
    template : `<div class="modal fade" id="myModal2" tabindex="-1" role="dialog"  aria-hidden="true">
				<div class="modal-dialog modal-dialog-centered" role="document">
					<div class="modal-content">
						<div class="modal-body">
							<div class="station-title">
								<span @click="tocheck(1)" data-id="1" :data-siteid="site_area_id" :data-sid=" province_id ">{{ province }}</span>
								<span @click="tocheck(2)" data-id="2" :data-siteid="site_area_id"  :data-sid=" city_id ">{{ city }}</span>
								<span @click="tocheck(3)" data-id="3" :data-siteid="site_area_id"  :data-sid=" area_id ">{{ area }}</span>
								<span @click="tocheck(4)" data-id="4" :data-siteid="site_area_id"  :data-sid=" town_id ">{{ town }}</span>
								<span @click="tocheck(5)" data-id="5" :data-siteid="site_area_id"  :data-sid=" last_id ">{{ last }}</span>
							</div>
							<div class="station-name-box">
								<span class="station-name one" v-if="checkindex ==1 " v-for="item in citylist_1" @click="one" :data-id="item.id" :data-siteid="item.site_id" :data-name="item.name">{{ item.name }}</span>
								<span class="station-name two" v-if="checkindex ==2 " v-for="item in citylist_2" @click="two" :data-id="item.id" :data-siteid="item.site_id"  :data-name="item.name">{{ item.name }}</span>
								<span class="station-name three" v-if="checkindex ==3 " v-for="item in citylist_3" @click="three" :data-id="item.id" :data-siteid="item.site_id"  :data-name="item.name">{{ item.name }}</span>
								<span class="station-name four" v-if="checkindex ==4 " v-for="item in citylist_4" @click="four" :data-id="item.id" :data-siteid="item.site_id"  :data-name="item.name">{{ item.name }}</span>
								<span class="station-name five" v-if="checkindex ==5 " v-for="item in citylist_5" @click="five" :data-id="item.site_id" :data-siteid="item.site_id"  :data-name="item.sitename">{{ item.sitename }}</span>
							</div>
							<div class="station-btn" data-dismiss="modal" @click="checkarea">选择当前行政区域</div>
							<div class="close-static-modal"><img data-dismiss="modal" src="../../static/icons/关闭.png" alt=""></div>
						</div>
					</div>
				</div>
			</div>`
});
/**
 * 富文本编辑器
 */
Vue.component('Ueditor' , {
    data(){
        return {
            editor : null
        };
    } ,
    props    : {
        defaultMsg : {
            type : String
        } ,
        config     : {
            type : Object
        }
    } ,
    mounted(){
        const _this = this;
        require.config({
            baseUrl : '' ,
            paths   : {
                ZeroClipboard : "../../jsc/UE/third-party/zeroclipboard/ZeroClipboard"//主要是加这句话
            }
        });
        require([ 'ZeroClipboard' ] , function( ZeroClipboard ){
            window[ 'ZeroClipboard' ] = ZeroClipboard;
        });
        this.editor = UE.getEditor('editor' , this.config); // 初始化UE
        this.editor.addListener("ready" , function(){
            _this.editor.setContent(_this.defaultMsg); // 确保UE加载完成后，放入内容。
        });
    } ,
    methods  : {
        getUEContent(){ // 获取内容方法
            return this.editor.getContent();
        } ,
        setUEContent : function( def ){
            this.editor.setContent(def);
        }
    } ,
    destroyed(){
        this.editor.destroy();
    } ,
    template : `<script id="editor" type="text/plain"  style="display:inline-block;height:240px;float: left;"></script>`
});
/***
 * 文章列表
 */

var articlelist   = Vue.component('articlelist' , {
    data(){
        return {
            articleList : [] ,
            total       : 1 ,
            page        : 1 ,
            limit       : 10 ,
            txt         : '' ,
            tag         : '' ,
            id          : ''
        };
    } ,
    watch    : {
        'defaultid' : function(){
            this.txt = this.defaulttag;
            this.id  = this.defaultid;
            if(this.$route.name==3) {
                this.getRightList(this.defaultid, 1);
            }
			else{
				 this.getRightList(this.defaultid);
			}
			
        }
    } ,
    props: [ 'defaulttag' , 'defaultid' , 'icon' ,'isfivesite'] ,
    mounted(){
        var that = this
        this.txt = this.defaulttag;
        this.id  = this.defaultid;
        setTimeout(function () {
            that.getRightList(that.defaultid,1);
        },1000)

        console.log(this.$options.props);
    } ,
    methods  : {
        getRightList( id , page ){
            this.id = id;
			if(page == 1){
				this.articleList = []
			}
            if (this.isfivesite){
				var siteid = JSON.parse(localStorage.getItem('station')) || {};
				axios.post(sysurl+'article/areaArticleList',{
					site_id:siteid.site_id,
					category_id:id,
					page:this.page,
					limit:this.limit
				}).then(res=>{
                    this.articleList = res.data.data.data;
                    this.total       = res.data.data.total;
                    this.page        = res.data.data.current_page;
				})
			} else{
				var siteid = JSON.parse(localStorage.getItem('station')) || {};
				axios.post(sysurl + 'index/articleList' , {
					category_id : id ,
					site_id:siteid.site_id,
					page        : page || 1 ,
					limit       : this.limit
				}).then(res => {
					this.articleList = res.data.data.data;
					this.total       = res.data.data.total;
					this.page        = res.data.data.current_page;
				});
			}

        } ,
        togglePage( page ){
            this.getRightList(this.id , page);
        } ,
        detail( id ){
            // console.log(id , 'aaa');
            this.$emit('getdetail' , id);
        }
    } ,
    filters:{
        // 过滤中文
        textFilter(txt){
            var str;
            str = txt.match(regHtml,"");
            return str.join("");
        }
    },
    template : `<div class="article-detail-r" style="width:58rem">
					<div class="article">
						<div class="article-header">
							<div class="article-header-inner">
								<div class="article-logo" style="background: none">
									<img :src="icon" alt="" style="object-fit: cover" width="100%" height="100%">
								</div>
								<div class="article-tip">{{ txt || defaulttag }}</div>
							</div>
<!--							<div class="article-hot">HOT</div>-->
						</div>
						<div class="article-list">
							<!--<a class="article-list-item" v-for="(item,index) in articleList" :href="'../../views/home/article.html?id=' + item.id + '&category_name='+ txt +'&tag='+ tag">-->
							<router-link :to="{ path:'/detail',query:{ articleid: item.id,id:id,category_name:defaulttag } }" class="article-list-item" v-for="(item,index) in articleList">
								<div class="article-item-content" style="width: 46rem">
									<div class="article-item-title">{{item.title}}</div>
									<div class="article-item-prop">
										<span v-if="item.resource">{{item.resource}}</span>
										<span v-if="item.publishtime_text">发布于：{{item.publishtime_text}}</span>
										<span v-if="item.comment">评论：{{item.comment}}</span>
									</div>
									
								</div>
							</router-link>
						</div>
						<v-pagination v-if="total" :total="total" :display="limit" :currentPage="page" v-on:pagechange="togglePage"></v-pagination>
					</div>
                </div>`
});

/***
 * 文章详情
 */
var articledetail = Vue.component('articledetail' , {
    data(){
        return {
            articleList   : [] ,
            parameter     : parameter ,
            site_data     : site ,
            name          : '' ,
            icons         : '',
            txt           : '' ,
            tag           : '' ,
            articleDetail : '' ,
            id            : '',
			footer:''
        };
    } ,
    props    : [ 'defaulttag' , 'defaultid' , 'icon' , 'defaultname' ] ,
	watch:{
		"defaultid":function(){
			this.id = this.$route && this.$route.query.articleid ? this.$route.query.articleid : this.defaultid;
			this.name = this.$route && this.$route.category_name ? this.$route.category_name : this.defaultname;
			this.getdetail();
		},
		"footer":function(){
			this.id = this.$route && this.$route.query.articleid ? this.$route.query.articleid : this.defaultid;
			this.name = this.$route && this.$route.category_name ? this.$route.category_name : this.defaultname;
			this.getfooter();
		}
	},
    mounted(){
        this.id = this.$route && this.$route.query.articleid ? this.$route.query.articleid : this.defaultid;
        this.name = this.$route && this.$route.category_name ? this.$route.category_name : this.defaultname;
		if(this.$route.query.footer){
			this.footer = this.$route.footer ;
			this.getfooter();
		}else{
			this.getdetail();
		}
       
        
    } ,
    methods  : {
        getdetail(){
            axios.post(sysurl + 'index/articleDetail' , {
                article_id : this.id,
				user_id:getCookie('user_id')
            }).then(res => {
                var datas = res.data;
                if( datas.code === 1 ){
                    this.articleDetail = datas.data;
                    this.getCommentList();
                }else{
                    layer.msg(res.data.msg);
                }
            } , err => {}).catch(( error ) => {});
        },
		getfooter(){
		    axios.post(sysurl + 'index/footArticleDetail' , {
		        id : this.id
		    }).then(res => {
		        var datas = res.data;
		        if( datas.code === 1 ){
		            this.articleDetail = datas.data;
		            this.getCommentList();
		        }else{
		            layer.msg(res.data.msg);
		        }
		    } , err => {}).catch(( error ) => {});
		}
    } ,
    template : `<div class="article-detail-r" style="width:58rem">
                    <div class="article-header">
                        <div class="article-header-inner">
                            <div class="article-logo" style="background: none">
                                <img :src="icon" alt="" style="object-fit: cover" width="100%" height="100%">
                            </div>
                            <div class="article-tip">{{defaulttag}}</div>
                        </div>
                    </div> 
                    <div class="article-content">
                        <div class="article-title">{{articleDetail.title||articleDetail.name}}</div>
                        <div class="article-props" v-if="!articleDetail.content">
                            <span>时间：{{articleDetail.publishtime_text}}</span>
                            <span>来源：{{articleDetail.resource}}</span>
                            <span>浏览次数：{{articleDetail.reading}}</span>
                        </div>
                        <div class="article-text" v-html="articleDetail.postcontent||articleDetail.content"></div>
                    </div>
                    <comment-component v-if="!articleDetail.content" type="article" :commentid="parseInt(parameter.articleid) || id" :siteid="site_data"></comment-component>
                </div>`
});
/***
 * 公告列表
 */

var noticelist   = Vue.component('noticelist' , {
    data(){
        return {
            articleList : [] ,
            total       : 1 ,
            page        : 1 ,
            limit       : 10 ,
            txt         : '' ,
            tag         : '' ,
            id          : ''
        };
    } ,
    watch    : {
        '$route' : function(){
            this.txt = this.defaulttag;
            this.id  = this.defaultid;
            if(this.$route.name==8){
                this.getRightList.bind(this)(this.defaultid , 1);
            }


        }
    } ,
    props: [ 'defaulttag' , 'defaultid' , 'icon' ,'isfivesite'] ,
    mounted(){

        var that = this
        this.txt = this.defaulttag;
        this.id  = this.defaultid;
        setTimeout(function () {
            that.getRightList.bind(that)(that.defaultid,1);
        },500)



    } ,
    methods  : {
        getRightList( id , page ){
            this.id = id;
            if (this.isfivesite){
                var forms = new FormData()
                forms.append("type",id)
                forms.append("page",this.page)
                forms.append("limit",this.limit)
                var siteid = JSON.parse(localStorage.getItem('station')) || {site_id:0};
                forms.append("site_id",siteid.site_id)
                axios.post(sysurl+'index/noticeList',forms).then(res=>{
                    this.articleList = res.data.data.data;
                    this.total       = res.data.data.total;
                    this.page        = res.data.data.current_page;
                })
            } else{
                var forms = new FormData()
                forms.append("type",id)
                forms.append("page",page || 1)
                forms.append("limit",this.limit)
                var siteid = JSON.parse(localStorage.getItem('station')) || {site_id:0};
                forms.append("site_id",siteid.site_id)
                axios.post(sysurl+'index/noticeList',forms).then(res=>{
                    this.articleList = res.data.data.data
                    this.total = res.data.data.total
                    this.page = res.data.data.current_page
                });
            }

        } ,
        togglePage( page ){
            this.getRightList.bind(this)(this.id , page);
        } ,
        detail( id ){
            // console.log(id , 'aaa');
            this.$emit('getdetail' , id);
        }
    } ,
    filters:{
        // 过滤中文
        textFilter(txt){
            var str;
            str = txt.match(regHtml,"");
            return str.join("");
        }
    },
    template : `<div class="article-detail-r" style="width:58rem">
					<div class="article">
						<div class="article-header">
							<div class="article-header-inner">
								<div class="article-logo" style="background: none">
									<img :src="icon" alt="" style="object-fit: cover" width="100%" height="100%">
								</div>
								<div class="article-tip">{{ txt || defaulttag }}</div>
							</div>
<!--							<div class="article-hot">HOT</div>-->
						</div>
						<div class="article-list">
							<!--<a class="article-list-item" v-for="(item,index) in articleList" :href="'../../views/home/article.html?id=' + item.id + '&category_name='+ txt +'&tag='+ tag">-->
							<router-link :to="{ path:'/noticedetail',query:{id:item.id} }" class="article-list-item" v-for="(item,index) in articleList">
<!--								<div class="article-item-img" :style="{'background-image' : 'url(' + item.coverimages_text[0] +')'}"></div>-->
								<div class="article-item-content" style="width: 46rem">
									<div class="article-item-title">{{item.title}}</div>
									<div class="article-item-prop">
<!--										<span v-if="item.resource">{{item.resource}}</span>-->
										<span v-if="item.publishtime_text">发布于：{{item.createtime_text}}</span>
<!--										<span v-if="item.comment">评论：{{item.comment}}</span>-->
									</div>
									<div class="article-item-text">{{item.content | textFilter}}</div>
								</div>
							</router-link>
						</div>
						<v-pagination v-if="total" :total="total" :display="limit" :currentPage="page" v-on:pagechange="togglePage"></v-pagination>
					</div>
                </div>`
});


/***
 * 公告详情
 */
var noticedetail = Vue.component('noticedetail' , {
    data(){
        return {
            articleList   : [] ,
            parameter     : parameter ,
            site_data     : site ,
            name          : '' ,
            icons         : '',
            txt           : '' ,
            tag           : '' ,
            articleDetail : '' ,
            id            : ''
        };
    } ,
    props    : [ 'defaulttag' , 'defaultid' , 'icon' , 'defaultname' ] ,

    watch    : {
        '$route' : function(){
            this.id = this.defaultid
            this.name = this.defaultname;

            // this.getdetail.bind(this)();

        }
    } ,
    created(){
        this.id = this.defaultid
        this.name = this.defaultname;
        this.getdetail.bind(this)();
    } ,
    methods  : {
        getdetail(){
            var forms = new FormData()
            forms.append("notice_id",this.$route.query.id)
            var siteid = JSON.parse(localStorage.getItem('station')) || {};
            axios.post(sysurl + 'index/noticeInfo' , forms).then(res => {
                var datas = res.data;
                if( datas.code === 1 ){
                    this.articleDetail = datas.data;
                    // this.getCommentList();
                }else{
                    layer.msg(res.data.msg);
                }
            } , err => {}).catch(( error ) => {});
        }
    } ,
    template : `<div class="article-detail-r" style="width:58rem">
                    <div class="article-header">
                        <div class="article-header-inner">
                            <div class="article-logo" style="background: none">
                                <img :src="icon" alt="" style="object-fit: cover" width="100%" height="100%">
                            </div>
                            <div class="article-tip">{{defaulttag}}</div>
                        </div>
<!--                        <div class="article-hot">HOT</div>-->
                    </div> 
                    <div class="article-content">
                        <div class="article-title">{{articleDetail.title}}</div>
                        <div class="article-props">
                            <span>时间：{{articleDetail.createtime_text}}</span>
<!--                            <span>来源：{{articleDetail.resource}}</span>-->
<!--                            <span>浏览次数：{{articleDetail.reading}}</span>-->
                        </div>
                        <div class="article-text" v-html="articleDetail.content"></div>
                    </div>
<!--                    <comment-component type="article" :commentid="parseInt(parameter.articleid) || id" :siteid="site_data"></comment-component>-->
                </div>`
});

//任务列表


var tasklist   = Vue.component('tasklist' , {
    data(){
        return {
            articleList : [] ,
            total       : 1 ,
            page        : 1 ,
            limit       : 10 ,
            txt         : '' ,
            tag         : '' ,
            id          : ''
        };
    } ,
    watch    : {
        '$route' : function(){
            this.txt = this.defaulttag;
            this.id  = this.defaultid;
            if(this.$route.name==19){
                this.getRightList.bind(this)(this.defaultid , 1);
            }


        }
    } ,
    props: [ 'defaulttag' , 'defaultid' , 'icon' ,'isfivesite'] ,
    mounted(){

        var that = this
        this.txt = this.defaulttag;
        this.id  = this.defaultid;
        setTimeout(function () {
            that.getRightList.bind(that)(that.defaultid,1);
        },500)



    } ,
    methods  : {
        getRightList( id , page ){
            this.id = id;
            if (this.isfivesite){
                var forms = new FormData()
                forms.append("type",id)
                forms.append("page",this.page)
                forms.append("limit",this.limit)
                var siteid = JSON.parse(localStorage.getItem('station')) || {site_id:0};
                forms.append("site_id",siteid.site_id)
                axios.post(sysurl+'asking/task',forms).then(res=>{
                    this.articleList = res.data.data.data;
                    this.total       = res.data.data.total;
                    this.page        = res.data.data.current_page;
                })
            } else{
                var forms = new FormData()
                forms.append("type",id)
                forms.append("page",page || 1)
                forms.append("limit",this.limit)
                var siteid = JSON.parse(localStorage.getItem('station')) || {site_id:0};
                forms.append("site_id",siteid.site_id)
                axios.post(sysurl+'asking/task',forms).then(res=>{
                    this.articleList = res.data.data.data
                    this.total = res.data.data.total
                    this.page = res.data.data.current_page
                });
            }

        } ,
        togglePage( page ){
            this.getRightList.bind(this)(this.id , page);
        } ,
        detail( id ){
            // console.log(id , 'aaa');
            this.$emit('getdetail' , id);
        }
    } ,
    filters:{
        // 过滤中文
        textFilter(txt){
            var str;
            str = txt.match(regHtml,"");
            return str.join("");
        }
    },
    template : `<div class="article-detail-r" style="width:58rem">
					<div class="article">
						<div class="article-header">
							<div class="article-header-inner">
								<div class="article-logo" style="background: none">
									<img :src="icon" alt="" style="object-fit: cover" width="100%" height="100%">
								</div>
								<div class="article-tip">{{ txt || defaulttag }}</div>
							</div>
<!--							<div class="article-hot">HOT</div>-->
						</div>
						<div class="article-list">
							<!--<a class="article-list-item" v-for="(item,index) in articleList" :href="'../../views/home/article.html?id=' + item.id + '&category_name='+ txt +'&tag='+ tag">-->
							<router-link :to="{ path:'/taskdetail',query:{id:item.id} }" class="article-list-item" v-for="(item,index) in articleList">
<!--								<div class="article-item-img" :style="{'background-image' : 'url(' + item.coverimages_text[0] +')'}"></div>-->
								<div class="article-item-content" style="width: 46rem">
									<div class="article-item-title">{{item.title}}</div>
									<div class="article-item-prop">
<!--										<span v-if="item.resource">{{item.resource}}</span>-->
										<span v-if="item.publishtime_text">发布于：{{item.createtime_text}}</span>
<!--										<span v-if="item.comment">评论：{{item.comment}}</span>-->
									</div>
									<div class="article-item-text">{{item.taskcontent | textFilter}}</div>
								</div>
							</router-link>
						</div>
						<v-pagination v-if="total" :total="total" :display="limit" :currentPage="page" v-on:pagechange="togglePage"></v-pagination>
					</div>
                </div>`
});

//任务管理
var taskmanager   = Vue.component('taskmanager' , {
    data(){
        return {
            articleList : [] ,
            total       : 1 ,
            page        : 1 ,
            limit       : 10 ,
            txt         : '' ,
            tag         : '' ,
            id          : ''
        };
    } ,
    watch    : {
        '$route' : function(){
            this.txt = this.defaulttag;
            this.id  = this.defaultid;
            if(this.$route.name==20){
                this.getRightList.bind(this)(this.defaultid , 1);
            }
			


        }
    } ,
    props: [ 'defaulttag' , 'defaultid' , 'icon' ,'isfivesite'] ,
    mounted(){

        var that = this
        this.txt = this.defaulttag;
        this.id  = this.defaultid;
        setTimeout(function () {
            that.getRightList.bind(that)(that.defaultid,1);
        },500)



    } ,
    methods  : {
        getRightList( id , page ){
			
			
			if(getCookie('token')){
				this.id = id;
				if (this.isfivesite){
				    var forms = new FormData()
				    forms.append("token",getCookie('token'))
				    forms.append("page",this.page)
				    forms.append("limit",this.limit)
				    var siteid = JSON.parse(localStorage.getItem('station')) || {site_id:0};
				    forms.append("site_id",siteid.site_id)
				    axios.post(sysurl+'asking/myTask',forms).then(res=>{
				        this.articleList = res.data.data.data;
				        this.total       = res.data.data.total;
				        this.page        = res.data.data.current_page;
				    })
				} else{
				    var forms = new FormData()
				  forms.append("token",getCookie('token'))
				    forms.append("page",page || 1)
				    forms.append("limit",this.limit)
				    var siteid = JSON.parse(localStorage.getItem('station')) || {site_id:0};
				    forms.append("site_id",siteid.site_id)
				    axios.post(sysurl+'asking/myTask',forms).then(res=>{
				        this.articleList = res.data.data.data
				        this.total = res.data.data.total
				        this.page = res.data.data.current_page
				    });
				}
			}else{
				layer.msg('请登录后操作')
				return false
			}
            

        } ,
        togglePage( page ){
            this.getRightList.bind(this)(this.id , page);
        } ,
        detail( id ){
            // console.log(id , 'aaa');
            this.$emit('getdetail' , id);
        },
		canceltask(id){
			var that = this
			layer.confirm("确定删除该任务？" , { btn : [ "确定" , "取消" ] } , function(index){
			    var forms = new FormData()
			    forms.append("token",getCookie('token'))
			    forms.append("task_id",id)
			    axios.post(sysurl+'asking/deleteTask',forms).then(res=>{
					that.getRightList.bind(that)(that.defaultid,1);
					layer.close(index);
			    });
			} , function( index ){
			    layer.close(index);
			});
			
			
		}
    } ,
    filters:{
        // 过滤中文
        textFilter(txt){
            var str;
            str = txt.match(regHtml,"");
            return str.join("");
        }
    },
    template : `<div class="article-detail-r" style="width:58rem">
					<div class="article">
						<div class="article-header">
							<div class="article-header-inner">
								<div class="article-logo" style="background: none">
									<img :src="icon" alt="" style="object-fit: cover" width="100%" height="100%">
								</div>
								<div class="article-tip">{{ txt || defaulttag }}</div>
							</div>
<!--							<div class="article-hot">HOT</div>-->
						</div>
						<div class="article-list">
							<!--<a class="article-list-item" v-for="(item,index) in articleList" :href="'../../views/home/article.html?id=' + item.id + '&category_name='+ txt +'&tag='+ tag">-->
							<a  class="article-list-item" v-for="(item,index) in articleList">
<!--								<div class="article-item-img" :style="{'background-image' : 'url(' + item.coverimages_text[0] +')'}"></div>-->
								<div class="article-item-content" style="width: 46rem">
									<div class="article-item-title">{{item.title}}</div>
									<div class="article-item-prop" style="float: right;">
<!--										<span v-if="item.resource">{{item.resource}}</span>-->
											<span @click="canceltask(item.id)">删除</span>
											<router-link :to="{ path:'/taskedit',query:{id:item.id} }" tag="span">编辑</router-link>
										<span v-if="item.publishtime_text">发布于：{{item.createtime_text}}</span>
<!--										<span v-if="item.comment">评论：{{item.comment}}</span>-->
									</div>
									<div class="article-item-text">{{item.taskcontent | textFilter}}</div>
								</div>
							</a>
						</div>
						<v-pagination v-if="total" :total="total" :display="limit" :currentPage="page" v-on:pagechange="togglePage"></v-pagination>
					</div>
                </div>`
});
//任务编辑
var taskedit = Vue.component('taskedit' , {
    data(){
        return {
            articleList   : [] ,
            parameter     : parameter ,
            site_data     : site ,
            name          : '' ,
            icons         : '',
            txt           : '' ,
            tag           : '' ,
            articleDetail : '' ,
            code:'必填',
            id            : '',
			tes:'',
			commentVal:'',
			title:''
        
        };
    } ,
    props    : [ 'defaulttag' , 'defaultid' , 'icon' , 'defaultname'] ,

    watch    : {
        '$route' : function(){
            this.id = this.defaultid
            this.name = this.defaultname;

            // this.getdetail.bind(this)();
        }
    } ,
    created(){
        this.id = this.defaultid
        this.name = this.defaultname;
        this.getdetail.bind(this)();
        
   
    } ,
    methods  : {
        getdetail(){
            var forms = new FormData()
            forms.append("task_id",this.$route.query.id)
            forms.append("token",getCookie("token"))
            var siteid = JSON.parse(localStorage.getItem('station')) || {};
            axios.post(sysurl + 'asking/taskDetail' , forms).then(res => {
                var datas = res.data;
                if( datas.code === 1 ){
                    this.articleDetail = datas.data;
                    // this.getCommentList();
					this.title = datas.data.title
					this.commentVal = datas.data.taskcontent
					this.tes = datas.data.tel
                }else{
                    layer.msg(res.data.msg);
                }
            } , err => {}).catch(( error ) => {});
        },
     
        submitA(){

            let data = new FormData();
            var siteid = JSON.parse(localStorage.getItem('station')) || {};
            data.append('task_id', this.$route.query.id);
            data.append('token', getCookie('token'));
            data.append('site_id', this.site_data.site_id || 0);
            data.append('user_id', getCookie('user_id'));
            data.append('title', this.title);
            data.append('taskcontent', this.commentVal);
            data.append('tel', this.tes);
            axios.post(sysurl + 'asking/editTask', data).then(res => {
                layer.msg(res.data.msg)
            })
        }
    } ,
    template : `<div class="article-detail-r" style="width:58rem"> 
                    <div class="article-header">
                        <div class="article-header-inner">
                            <div class="article-logo" style="background: none">
                                <img :src="icon" alt="" style="object-fit: cover" width="100%" height="100%">
                            </div>
                            <div class="article-tip">{{defaulttag}}</div>
                        </div>
<!--                        <div class="article-hot">HOT</div>-->
                    </div> 
                    <div class="article-content" style="padding: 1rem 0">
                    
                    
                       
                         <div class="new-list-item">
                            <span>任务标题</span>
                            <input type="text" name="title" placeholder="请输入标题" v-model="title">
                        </div>
                        <div class="new-list-item" style="align-items: baseline">
                            <span>任务描述</span>
                            <textarea name="" id="" cols="30" rows="10" maxlength="200" v-model="commentVal" placeholder="请输入留言内容"></textarea>
                            <span class="text-num">{{commentVal.length}}/200</span>
                        </div>
                      <div class="new-list-item">
                          <span>联系电话</span>
                          <input type="text" name="tes" placeholder="请输入电话" v-model="tes">
                      </div>
                        <div class="new-list-item">
                            <span>&nbsp;</span>
                            <div class="button" @click="submitA">提交</div>
                        </div>
                       
                    </div>


                </div>`
});



//任务详情

var taskdetail = Vue.component('taskdetail' , {
    data(){
        return {
            articleList   : [] ,
            parameter     : parameter ,
            site_data     : site ,
            name          : '' ,
            icons         : '',
            txt           : '' ,
            tag           : '' ,
            articleDetail : '' ,
            id            : ''
        };
    } ,
    props    : [ 'defaulttag' , 'defaultid' , 'icon' , 'defaultname' ] ,

    watch    : {
        '$route' : function(){
            this.id = this.defaultid
            this.name = this.defaultname;

            // this.getdetail.bind(this)();

        }
    } ,
    created(){
        this.id = this.defaultid
        this.name = this.defaultname;
        this.getdetail.bind(this)();
    } ,
    methods  : {
        getdetail(){
            var forms = new FormData()
            forms.append("task_id",this.$route.query.id||0)
            forms.append("token",getCookie("token"))
            var siteid = JSON.parse(localStorage.getItem('station')) || {};
            axios.post(sysurl + 'asking/taskDetail' , forms).then(res => {
                var datas = res.data;
                if( datas.code === 1 ){
                    this.articleDetail = datas.data;
                    // this.getCommentList();
                }else{
                    layer.msg(res.data.msg);
                }
            } , err => {}).catch(( error ) => {});
        }
    } ,
    template : `<div class="article-detail-r" style="width:58rem">
                    <div class="article-header">
                        <div class="article-header-inner">
                            <div class="article-logo" style="background: none">
                                <img :src="icon" alt="" style="object-fit: cover" width="100%" height="100%">
                            </div>
                            <div class="article-tip">{{defaulttag}}</div>
                        </div>
<!--                        <div class="article-hot">HOT</div>-->
                    </div> 
                    <div class="article-content">
                        <div class="article-title">{{articleDetail.title}}</div>
                        <div class="article-props">
                            <span>时间：{{articleDetail.createtime_text}}</span>
                            <span>电话：{{articleDetail.tel}}</span>
                           <span>来源：{{articleDetail.user.username}}</span>
<!--                            <span>浏览次数：{{articleDetail.reading}}</span>-->
                        </div>
                        <div class="article-text" v-html="articleDetail.taskcontent"></div>
                    </div>
<!--                    <comment-component type="article" :commentid="parseInt(parameter.articleid) || id" :siteid="site_data"></comment-component>-->
                </div>`
});



/***
 * 富文本详情
 */
var editdetail = Vue.component('editdetail' , {
    data(){
        return {
            articleList   : [] ,
            parameter     : parameter ,
            site_data     : site ,
            name          : '' ,
            icons         : '',
            txt           : '' ,
            tag           : '' ,
            articleDetail: {},
            id            : '',
            isshow:false
        };
    } ,
    props    : [ 'defaulttag' , 'defaultid' , 'icon' , 'defaultname' ] ,

    watch    : {
        '$route' : function(){

            if(this.$route.name == 1){
                this.id = this.defaultid
                this.name = this.defaultname;

                this.getdetail.bind(this)();
            }


        }
    } ,
    mounted(){
        var that = this


        setTimeout(function () {
            that.id = that.defaultid
            that.name = that.defaultname;
            that.getdetail.bind(that)();
        },1000)

    } ,
    methods  : {
        getdetail(){
            var siteid = JSON.parse(localStorage.getItem('station')) || {};
            axios.post(sysurl + 'index/firstArticle' , {
                category_id : this.defaultid,
                site_id:siteid.site_id,
            }).then(res => {
                var datas = res.data;
                if( datas.code === 1 ){
                    if(datas.data!=null){
                        this.isshow = true
                        this.articleDetail = datas.data;
                        this.getCommentList();
                    }

                }else{
                    layer.msg(res.data.msg);
                }
            } , err => {}).catch(( error ) => {});
        }
    } ,
    template : `<div class="article-detail-r" style="width:58rem">
                    <div class="article-header">
                        <div class="article-header-inner">
                            <div class="article-logo" style="background: none">
                                <img :src="icon" alt="" style="object-fit: cover" width="100%" height="100%">
                            </div>
                            <div class="article-tip">{{defaulttag}}</div>
                        </div>
<!--                        <div class="article-hot">HOT</div>-->
                    </div> 
                    <div class="article-content" v-if="isshow">
                        <div class="article-title">{{articleDetail.title}}</div>
                        <div class="article-props">
                            <span>时间：{{articleDetail.publishtime_text}}</span>
                            <span>来源：{{articleDetail.resource}}</span>
                            <span>浏览次数：{{articleDetail.reading}}</span>
                        </div>
                        <div class="article-text" v-html="articleDetail.postcontent"></div>
                    </div>
                    <comment-component type="article" :commentid="parseInt(parameter.articleid) || id" :siteid="site_data" v-if="isshow"></comment-component>
                </div>`
});

//任务发布
var taskpuber = Vue.component('taskpuber' , {
    data(){
        return {
            articleList   : [] ,
            parameter     : parameter ,
            site_data     : site ,
            name          : '' ,
            icons         : '',
            txt           : '' ,
            tag           : '' ,
            articleDetail : '' ,
            code:'必填',
            id            : '',
			tes:'',
			commentVal:'',
			title:''
        
        };
    } ,
    props    : [ 'defaulttag' , 'defaultid' , 'icon' , 'defaultname'] ,

    watch    : {
        '$route' : function(){
            this.id = this.defaultid
            this.name = this.defaultname;

            // this.getdetail.bind(this)();
        }
    } ,
    created(){
        this.id = this.defaultid
        this.name = this.defaultname;
        this.getdetail.bind(this)();
        
   
    } ,
    methods  : {
        getdetail(){
            var forms = new FormData()
            forms.append("notice_id",this.defaultid||0)
            var siteid = JSON.parse(localStorage.getItem('station')) || {};
            axios.post(sysurl + 'index/noticeInfo' , forms).then(res => {
                var datas = res.data;
                if( datas.code === 1 ){
                    this.articleDetail = datas.data;
                    // this.getCommentList();
                }else{
                    layer.msg(res.data.msg);
                }
            } , err => {}).catch(( error ) => {});
        },
     
        submitA(){

            let data = new FormData();
            var siteid = JSON.parse(localStorage.getItem('station')) || {};
            data.append('token', getCookie('token'));
            data.append('site_id', this.site_data.site_id || 0);
            data.append('user_id', getCookie('user_id'));
            data.append('title', this.title);
            data.append('taskcontent', this.commentVal);
            data.append('tel', this.tes);
            axios.post(sysurl + 'asking/addTask', data).then(res => {
                layer.msg(res.data.msg)
            })
        }
    } ,
    template : `<div class="article-detail-r" style="width:58rem"> 
                    <div class="article-header">
                        <div class="article-header-inner">
                            <div class="article-logo" style="background: none">
                                <img :src="icon" alt="" style="object-fit: cover" width="100%" height="100%">
                            </div>
                            <div class="article-tip">{{defaulttag}}</div>
                        </div>
<!--                        <div class="article-hot">HOT</div>-->
                    </div> 
                    <div class="article-content" style="padding: 1rem 0">
                    
                    
                       
                         <div class="new-list-item">
                            <span>任务标题</span>
                            <input type="text" name="title" placeholder="请输入标题" v-model="title">
                        </div>
                        <div class="new-list-item" style="align-items: baseline">
                            <span>任务描述</span>
                            <textarea name="" id="" cols="30" rows="10" maxlength="200" v-model="commentVal" placeholder="请输入留言内容"></textarea>
                            <span class="text-num">{{commentVal.length}}/200</span>
                        </div>
                      <div class="new-list-item">
                          <span>联系电话</span>
                          <input type="text" name="tes" placeholder="请输入电话" v-model="tes">
                      </div>
                        <div class="new-list-item">
                            <span>&nbsp;</span>
                            <div class="button" @click="submitA">提交</div>
                        </div>
                       
                    </div>



                </div>`
});


/***
 * 投诉建议
 */
var Complaint = Vue.component('Complaint' , {
    data(){
        return {
            articleList   : [] ,
            parameter     : parameter ,
            site_data     : site ,
            name          : '' ,
            icons         : '',
            txt           : '' ,
            tag           : '' ,
            articleDetail : '' ,
            code:'必填',
            id            : '',
            citylist_1: [],
            citylist_2: [],
            citylist_3: [],
            citylist_4: [],
            province_id: 0,
            city_id: 0,
            area_id: 0,
            town_id: 0,
            city_name: '',
            checkindex: 1,
            province: '',
            city: '',
            area: '',
            town: '',
            areavalue: '',
            area_level: '',
            site_area_id: '',
            tips: '',
            truecode: false,
            trueusername:'null',
            time:60,
            site_level:'',
            timeOff: true,
            staation_name_default:'',
            commentVal:'',
            type:'',
            title:'',
            captcha:'',
            captchaCode:'http://api.jyshfw.com/api/user/captcha?token='+getCookie("token"),
            islogin:false
        };
    } ,
    props    : [ 'defaulttag' , 'defaultid' , 'icon' , 'defaultname'] ,

    watch    : {
        '$route' : function(){
            this.id = this.defaultid
            this.name = this.defaultname;

            // this.getdetail.bind(this)();
        }
    } ,
    created(){
        this.id = this.defaultid
        this.name = this.defaultname;
        this.getdetail.bind(this)();
        if(getCookie('token') == null||getCookie('token')==''){
            this.islogin = true
            this.code='登录后获取验证码'
        }else{
            this.islogin = false
            this.code='必填'
        }
        this.getcity()
    } ,
    methods  : {

        exchange(){

            this.captchaCode = 'http://api.jyshfw.com/api/user/captcha/?token='+getCookie("token")+'&time='+new Date()
        },
        getdetail(){
            var forms = new FormData()
            forms.append("notice_id",this.defaultid||0)
            var siteid = JSON.parse(localStorage.getItem('station')) || {};
            axios.post(sysurl + 'index/noticeInfo' , forms).then(res => {
                var datas = res.data;
                if( datas.code === 1 ){
                    this.articleDetail = datas.data;
                    // this.getCommentList();
                }else{
                    layer.msg(res.data.msg);
                }
            } , err => {}).catch(( error ) => {});
        },
        /**
         * 返回指定级
         */
        tocheck: function (e) {
            console.log(e);
            switch (e) {
                case 1:
                    this.province_id = 0;
                    this.city_id = 0;
                    this.area_id = 0;
                    this.town_id = 0;
                    this.province = '';
                    this.city = '';
                    this.area = '';
                    this.town = '';
                    this.checkindex = 1;
                    this.site_level = 1;
                    break;
                case 2:
                    this.city_id = 0;
                    this.area_id = 0;
                    this.town_id = 0;
                    this.area = '';
                    this.town = '';
                    this.checkindex = 2;
                    this.site_level = 2;
                    break;
                case 3:
                    this.area_id = 0;
                    this.town_id = 0;
                    this.town = '';
                    this.checkindex = 3;
                    this.site_level = 3;
                    break;
                case 4:
                    return false;
                    break;
            }
            this.site_area_id = '';
            this.getcity();
        },
        /**
         * 获取城市列表
         */
        getcity: function () {
            let data = new FormData();
            data.append('province_id', this.province_id);
            data.append('city_id', this.city_id);
            data.append('area_id', this.area_id);
            data.append('town_id', this.town_id);
            console.log(data, '数据');
            axios.post(sysurl + 'common/areaFour', data).then(res => {
                this.citylist_1 = res.data.data;
                this.citylist_2 = res.data.data;
                this.citylist_3 = res.data.data;
                this.citylist_4 = res.data.data;
            })
        },
        /**
         * 城市选择
         */
        one: function (e) {
            this.province_id = e.target.dataset.id;
            this.checkindex = 2;
            this.site_level = 1;
            this.province = e.target.dataset.name;
            this.getcity()
        },
        two: function (e) {
            this.city_id = e.target.dataset.id;
            this.checkindex = 3;
            this.site_level = 2;
            this.city = '/' + e.target.dataset.name;
            this.getcity()
        },
        three: function (e) {
            this.area_id = e.target.dataset.id;
            this.checkindex = 4;
            this.site_level = 3;
            this.area = '/' + e.target.dataset.name;
            this.getcity()
        },
        four: function (e) {
            this.site_level = 4;
            this.town_id = e.target.dataset.id;
            this.town = '/' + e.target.dataset.name;
        },
        /**
         * 确认选择城市
         */
        checkarea: function () {
            this.areavalue = this.province + this.city + this.area + this.town;
            this.province_id == 0 ? layer.msg('请选择省份') : this.site_area_id = this.province_id;
            this.city_id == 0 ? console.log('只选择了省份') : this.site_area_id = this.city_id;
            this.area_id == 0 ? console.log('选择了城市') : this.site_area_id = this.area_id;
            this.town_id == 0 ? console.log('选择到了镇') : this.site_area_id = this.town_id;
            console.log(this.site_area_id, '最终选择的城市', this.province + this.city + this.area + this.town, this.site_level, '层级');
            this.staation_name_default = this.areavalue.split("/")[this.areavalue.split("/").length-1]
        },
        submitA(){

            let data = new FormData();
            var siteid = JSON.parse(localStorage.getItem('station')) || {};
            data.append('token', getCookie('token'));
            data.append('site_id', this.site_data.site_id || 0);
            data.append('type', this.defaultid);
            data.append('title', this.title);
            data.append('messagecontent', this.commentVal);
            data.append('captcha', this.captcha);
            axios.post(sysurl + 'user/guest', data).then(res => {
                layer.msg(res.data.msg)
            })
        }
    } ,
    template : `<div class="article-detail-r" style="width:58rem"> 
                    <div class="article-header">
                        <div class="article-header-inner">
                            <div class="article-logo" style="background: none">
                                <img :src="icon" alt="" style="object-fit: cover" width="100%" height="100%">
                            </div>
                            <div class="article-tip">{{defaulttag}}</div>
                        </div>
<!--                        <div class="article-hot">HOT</div>-->
                    </div> 
                    <div class="article-content" style="padding: 1rem 0">
                    
                    
                        <div class="new-list-item"  data-toggle="modal" data-target="#myModal2" style="display: none">
                            <span>你想反映的问题发生在哪里</span>
                            <input type="text" :value="areavalue" :data-id="site_area_id" :data-level="area_level"
                                  placeholder="省/市/区/县/镇/基层" name="website"
                                   readonly>
                        </div>
                         <div class="new-list-item">
                            <span>标题</span>
                            <input type="text" name="title" placeholder="请输入标题" v-model="title">
                        </div>
                        <div class="new-list-item" style="align-items: baseline">
                            <span>留言内容</span>
                            <textarea name="" id="" cols="30" rows="10" maxlength="200" v-model="commentVal" placeholder="请输入留言内容"></textarea>
                            <span class="text-num">{{commentVal.length}}/200</span>
                        </div>
                        <div class="new-list-item">
                            <span>验证码</span>
                            <input type="text" :placeholder="code" style="width: 15rem" v-model="captcha" :readonly="islogin">
                            <img :src="captchaCode" alt="">
                            <span @click="exchange" style="cursor: pointer">换一换</span>
                        </div>
                        <div class="new-list-item">
                            <span>&nbsp;</span>
                            <div class="button" @click="submitA">提交</div>
                        </div>
                       
                    </div>
					<message-component :type="defaultid" :siteid="site_data"></message-component>

\t<div class="modal fade" id="myModal2" tabindex="-1" role="dialog" aria-hidden="true">
\t\t<div class="modal-dialog modal-dialog-centered" role="document">
\t\t\t<div class="modal-content">
\t\t\t\t<div class="modal-body">
\t\t\t\t\t<div class="station-title">
\t\t\t\t\t\t<span @click="tocheck(1)" data-id="1" :data-sid=" province_id ">{{ province }}</span>
\t\t\t\t\t\t<span @click="tocheck(2)" data-id="2" :data-sid=" city_id ">{{ city }}</span>
\t\t\t\t\t\t<span @click="tocheck(3)" data-id="3" :data-sid=" area_id ">{{ area }}</span>
\t\t\t\t\t\t<span @click="tocheck(4)" data-id="4" :data-sid=" town_id ">{{ town }}</span>
\t\t\t\t\t</div>
\t\t\t\t\t<div class="station-name-box">
\t\t\t\t\t\t<span class="station-name one" v-if="checkindex ==1 " v-for="item in citylist_1" @click="one"
\t\t\t\t\t\t\t  :data-id="item.id" :data-name="item.name">{{ item.name }}</span>
\t\t\t\t\t\t<span class="station-name two" v-if="checkindex ==2 " v-for="item in citylist_2" @click="two"
\t\t\t\t\t\t\t  :data-id="item.id" :data-name="item.name">{{ item.name }}</span>
\t\t\t\t\t\t<span class="station-name three" v-if="checkindex ==3 " v-for="item in citylist_3"
\t\t\t\t\t\t\t  @click="three" :data-id="item.id" :data-name="item.name">{{ item.name }}</span>
\t\t\t\t\t\t<span class="station-name four" v-if="checkindex ==4 " v-for="item in citylist_4" @click="four"
\t\t\t\t\t\t\t  :data-id="item.id" :data-name="item.name">{{ item.name }}</span>
\t\t\t\t\t</div>
\t\t\t\t\t<div style="display: flex">
\t\t\t\t\t\t<div class="station-btn" data-dismiss="modal" @click="checkarea" style="flex: .4">选择当前行政区域</div>
\t\t\t\t\t\t<!--<div class="station-btn" data-dismiss="modal" v-if="town!=''" style="flex: .4" @click="register_five">注册基层站长</div>-->
\t\t\t\t\t</div>
\t\t\t\t\t<div class="close-static-modal"><img data-dismiss="modal" src="../../static/icons/关闭.png" alt="">
\t\t\t\t\t</div>
\t\t\t\t</div>
\t\t\t</div>
\t\t</div>
\t</div>

                </div>`
});

//服务中心

var classify = Vue.component('service-component' , {
    data     : function(){
        return {
            count  : 0 ,
            top    : [] ,
            bottom : [],
            id:'',
            name:''
            // url:'http://192.168.0.168'
        };
    } ,
    watch    : {
        '$route' : function(){
            this.id = this.defaultid
            this.name = this.defaultname;
            if(this.$route.name==4){
                this.getDetail();
            }


        }
    } ,
    props    : [ 'defaulttag' , 'defaultid' , 'icon' , 'defaultname' ] ,
    mounted(){
        this.getDetail();
    } ,
    methods  : {
        getDetail : function(){
			let siteid = JSON.parse(localStorage.getItem('station')).site_id || 0
            axios.post(sysurl + 'index/categoryToNav' , { category_id : this.defaultid,site_id:siteid }).then(res => {
                if( res.data.code === 1 ){
                    this.top = res.data.data;
                }else{
                    layer.msg(res.data.msg);
                }
            } , err => {
            }).catch(( error ) => {
            });

        } ,
        openLink  : function( link ){
            window.open(link);
        }
    } ,
    template : `
<div class="article-detail-r" style="width:58rem">
                    <div class="article-header">
                        <div class="article-header-inner">
                            <div class="article-logo" style="background: none">
                                <img :src="icon" alt="" style="object-fit: cover" width="100%" height="100%">
                            </div>
                            <div class="article-tip">{{defaulttag}}</div>
                        </div>
<!--                        <div class="article-hot">HOT</div>-->
                    </div> 
                    <div class="classify-box">
                    <div class="classify-top">
                        <div class="classify-item" v-for="(t,item) in top" :key="item">
                            <a>【{{t.name}}】</a>
                            <a :href="i.url" v-for="(i,index) in t.child" :key="index" target="_blank" class=" t-ellipsis">
                                <img v-if="i.iconimage!==''" class="icon-img" :src="i.iconimage_text" alt="">
                                <span>{{i.name}}</span>
                            </a>
                        </div>
                    </div>

                   
                </div>
                </div>




`
});

//地图

var mapbox = Vue.component('mapbox-component' , {
    data     : function(){
        return {
            count  : 0 ,
            top    : [] ,
            baseData : {},
            id:'',
            name:''

            // url:'http://192.168.0.168'
        };
    } ,
    watch    : {
        '$route' : function(){
            this.id = this.defaultid
            this.name = this.defaultname;
            if(this.$route.name == 7){
                this.getdetail.bind(this)();
            }


        }
    } ,
    props    : [ 'defaulttag' , 'defaultid' , 'icon' , 'defaultname' ] ,
    mounted(){
        axios.post(sysurl + 'index/siteConfig' , {}).then(res => {
            var datas = res.data;
            if( datas.code === 1 ){
                this.baseData = datas.data;
                var map = new BMap.Map("allmap");
                var point = new BMap.Point(116.331398,39.897445);
                map.centerAndZoom(point,12);
                // 创建地址解析器实例
                var myGeo = new BMap.Geocoder();
                // 将地址解析结果显示在地图上,并调整地图视野
                myGeo.getPoint(datas.data.address, function(point){
                    if (point) {
                        map.centerAndZoom(point, 17);
                        map.addOverlay(new BMap.Marker(point));
                    }else{
//            alert("您选择地址没有解析到结果!");
                    }
                }, "成都市");
                map.enableScrollWheelZoom(true);     //开启鼠标滚轮缩放

            }else{
                layer.msg(res.data.msg);
            }
        } , err => {
        }).catch(( error ) => {
        });



    } ,
    methods  : {

    } ,
    template : `
<div class="article-detail-r" style="width:58rem">
                    <div class="article-header">
                        <div class="article-header-inner">
                            <div class="article-logo" style="background: none">
                                <img :src="icon" alt="" style="object-fit: cover" width="100%" height="100%">
                            </div>
                            <div class="article-tip">{{defaulttag}}</div>
                        </div>
<!--                        <div class="article-hot">HOT</div>-->
                    </div> 
                    <p style="padding: 20px 0;font-size: 18px;font-weight: bold">地址：{{baseData.address}}</p>
                    <div class="classify-box" id="allmap"></div>
                </div>




`
});
//跳转链接
var urlbox = Vue.component('urlbox-component' , {
    data     : function(){
        return {
            count  : 0 ,
            top    : [] ,
            baseData : {},
            id:'',
            name:''

            // url:'http://192.168.0.168'
        };
    } ,
    watch    : {
        '$route' : function(){
            this.id = this.defaultid
            this.name = this.defaultname;

        }
    } ,
    props    : [ 'defaulttag' , 'defaultid' , 'icon' , 'defaultname' ] ,
    mounted(){




    } ,
    methods  : {

    } ,
    template : `
<div class="article-detail-r" style="width:58rem">
                    <div class="article-header">
                        <div class="article-header-inner">
                            <div class="article-logo" style="background: none">
                                <img :src="icon" alt="" style="object-fit: cover" width="100%" height="100%">
                            </div>
                            <div class="article-tip">{{defaulttag}}</div>
                        </div>
                    </div> 
                    <a :href="defaultid" style="margin: 20px 0;font-size: 18px;font-weight: bold;display: block" target="_blank">链接地址：{{defaultid}}</a>
                    
                </div>




`
});

// 行政站内容详情
var sitedetail = Vue.component('sitedetail', {
	data: function () {
		return {
			data: ''
		}
	},
	props: ['id'],
	mounted() {
		let d = new FormData();
		d.append('article_id',this.id);
		if (getCookie('user_id')){
			d.append('user_id',getCookie('user_id'));
			d.append('url',location.pathname+encodeURI(location.search));
		}
		axios.post(sysurl + 'index/articleDetail', d).then(res => {
			// console.log(res);
			if (res.data.code == 1) {
				this.data = res.data.data;
			} else {
				layer.msg(res.data.msg)
			}
		})
	},
	methods: {},
	template: `<div class="sitedetail">
                  <div class="title text-center">{{ data.title }}</div>
                  <div class="info text-center" style="color:#999;">
                      时间：{{ data.publishtime_text }}&nbsp;&nbsp;
                      阅读：{{ data.reading }}
<!--                      评论：{{data.comment}}-->
                  </div>
                  <div class="content" v-html="data.postcontent">
                      {{ data.postcontent }}
                  </div>
			   </div>`
});
